Self updating android system application with root access - android

I have created my custom ROM from aosp. I have also included my application, lets call it myCustomInstaller.apk (1.0) in the custom ROM while building. The application basically is kind of Google play Store. The application has system privileges and can install or remove applications silently.
I am able to install, update or remove any other applications. The problem I am facing is, When I am updating the myCustomInstaller.apk to 2.0 itself, the application is also installed silently, I am able to see the latest version installed in installed apps, but when i restart the phone, myCustomInstaller app reverts back to the original version.
I really don't know how to proceed, How is google playstore updating itself, and installing other application? Do I need any other permissions to make the updated version of myCustomInstaller app persist?
I am using this for silently installing, yes I do modified code for updating and removing
https://code.google.com/p/auto-update-apk-client/

Did you make sure to increment the android:versionCode in your Manifest? If not, the updated version, which will only get stored in the /data/ directory will be deleted when you boot.

Related

Update system app in android

I have developed an android app and put this as prebuilt APK in AOSP.
So the app will be installed in /system/app as a system app.
The app has update function itself by downloading and installing the newer version APK.
But it does not work because system app cannot be updated.
Is there any way to update self-made system app?
System app can be updated, in two ways:
Updated by the ota updating, this will change the app directly, and the app still exist on /system.
updated by using package install api, this need the new version apk have the same signature with the one on /system, and the new version will be installed on /data. That means, if the device is reset, the new version will lose.
Ota update is a normal way for system app updating.
Yes, you can install an updated version of your original system app into the /data partition, provided that:
1. Both app versions are signed with the same key;
2. The updated app’s versionCode is greater than or equal to the original app’s.
One way to do this update is to use the following adb command: adb install -r <your updated apk file>. Then you can test your updated version without having to rebuild your AOSP code.
Note that your updated version in the /data partition will be removed via a factory data reset. In this case your original system app will take effect again.

android update/install version checking

i'm new in android developing. (and in developing after all)
Here is my problem: If i install my android application onto my mobile device or AVD, i want it to check the current app version number and if it's lower than the one i want to install currently then install it, and if it is higher , then alert the users that they already use the latest version.
Because now when i install the .apk file, it just installs the app again and nothing happens.
Is it possible to develop this?
Best regards,
weeyas
The install process is managed at the system level, so your application has no control over it. As per the versioning guide, the Android system will only allow you to install updates from the same or newer version codes (i.e., version 1 can be replaced by version 2, but version 2 can never be overridden by version 1 unless you do a complete uninstall/reinstall). This applies to both Google Play updates and sideloading APKs yourself.
I don't know if it is possible if you try to install application from .APK file. However, you will not be able to publish the newest apk to Google Play if it has the same or lower version number than the current one.

Android apk replace vs Update

I have an application already installed on the mobile, am trying to install the update version of it.
I placed the apk inside the data/data folder, using file manager at the path,am trying to install it -
it shows a dialog to replace but not upgarde (Signed with the same key-store and version code/version name has an incremental value).
Could someone explain me more on this?
There is a difference between installing and subsequently, updating, apps off Google Play. Applications installed via a File Manager, for instance, will always prompt you to replace and not update an application. Side-loading apps on devices directly, does not have that mechanism to update. This is true not only for your app, but for every app.
It does not matter how it was signed or even the increment of your app's version.
Upgrade is only possible when you actually follow the installation procedure from Android Market. Else, it would just be a replace.

Upgrade apk downloaded from own web server

I need help in upgrading apk file. I have apk file developed for android 2.2 and I donot wish to publish my apk on android market. I published apk in our own webserver. And i could download it to my android mobile. Now the issue is that how can i upgrade apk file by publishing in our webserver.
My questions are:
How android market does apk upgrading?
How to upgrade a binary in android mobile with new version of which old version is already installed?
I used android built in view using intent which actually Re-installs apk not upgrading.But i don't want prompts asking "Do u want to install application?".
I want the apk to be upgraded once user click upgrade button without showing prompt to user, like doing in android market.
Is there any method to upgrade apk in android?
Are there any restrictions doing that?
Are there any specific permissions i need or i need to set in manifest file.
Once you've downloaded the APK, Android itself decides if the program is installed and needs to be upgraded, or if it is a new installation. Users can decide for themselves whether to upgrade or not.
Besides how to find out when there is an update available, it's not possible to upgrade it without prompting the user with the "Do you want to install". Android doesn't allow third apps to install apps unless the phone is rooted and your app has root access, but I think that this isn't your target group.
I have no experience with that but what you could try is loading classes manually from your server and then store it in the assets folder.
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
This is one approach, I don't think that it's very handy and easy but it would work.
Hope it helps!
PS:
And just because I'm wondering, is there a reason why don't you wanna publish it on the Android Market?
When you are publishing an App on your private web server, you need to create a process through which you can check for new version .There is No in built method for doing this .
I have created one as well.

What makes an Android app re-installable?

Through Eclipse I can easily re-install (without having to uninstall the app first), a small app I am currently developing, any change any number of times.
When I export that app ("release mode") and place it on a website, it downloads and installs without any problem. (I have to check "Unknown sources" for allowing installation of non-Market apps first, of course).
If I uninstall this app, then download it again and install it again, it installs without any problem.
However, if I try to re-install this app without uninstalling it first, then Android notifies that the installation failed.
My question is why? What makes an Android app re-installable? (i.e. without having to uninstall it first, thus losing its existing settings)
You cannot replace a signed application with an unsigned one.
You fail to install it because it has the same app version. If you recompile it and then download it, it will update, because the version will have changed.

Categories

Resources