How can I update all applications programmatically

How can I update all applications programmatically?

I want to create an update manager. List all updates and suggestions for the user to update. After clicking, the program will update the application.

How can I update the app on an Android device?

+3


source to share


3 answers


Download the file from the update server (can be anything and use any suitable protocol). Then open it with vnd.android.package-archive:

Intent reinstall = new Intent(Intent.ACTION_VIEW);
reinstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
reinstall.setDataAndType(Uri.fromFile("MyGreatApplication.apk"),
    "application/vnd.android.package-archive");
startActivity(reinstall);

      



This will launch the installer. Make sure you always use the same keystore and key for signing applications, otherwise the old application may be overwritten only if the user manually deletes the existing version.

+2


source


How can I update all applications programmatically?

You can not.

I want to create an update manager.



This is the responsibility of the "market" application such as the Play Store client, Amazon AppStore Android client, etc.

List all updates and suggestions for the user to update.

You don't know what updates are, let alone the ability to perform updates.

+1


source


If you mean Google Play updates

There is no way to do this using the publicly available SDK. The Google Play app already handles this for you, and Google hasn't provided an API to hook up or control this behavior.

If you mean sideloadable app updates, both yours and others

It is possible. You will need to check the version of each app on the device you want to update and have a server somewhere that can tell you the latest version. If the server says a newer version is available, upload the new apk version to the shared storage on the device and use the Intent to run the installer. It cannot be a silent install and the user will have to manually reconcile each update. In addition, the apk update must be signed with the same key as the old one and must have the same package name.

+1


source







All Articles