How to update the APK of my application, when the user requests?

2

Explanation:

I have an application that is constantly made enough changes, and every time I do, I generate a new version with the same Private Key ( Keystore ), ie when I send the new < strong> *. APK install on the device no configuration is lost and the application is simply updated. So far so good.

Question:

However, I do not want the user to have to download a new * .APK on my site and later install every time I need to update it, make a "Refresh" button and when you click, download the new *. APK with a progress bar monitoring the end of the download for the device, and automatically install it, with another progress bar monitoring the end ( if it is not possible it can be an "ajax" that would be that progress that keeps spinning without forecast ), how should I do this?

Important detail:

I do not want to use Google Play to do this for me because some users who have my application can not use, for example, version 1.21, and only 1.20, others already can upgrade to version 1.21.

And also, I would not like the update to be performed automatically, since I need the user to finish all the services in your application before you can upgrade. And it should only refresh when prompted to click the button.

    
asked by anonymous 12.03.2014 / 15:28

2 answers

2

You can even have a button in the application that downloads an apk, but the user will have to access this apk and request the update manually. Only the operating system can upgrade an application. No app has this level of permission because it would be a serious security flaw, especially if your APK requires new permissions.

The Play Store offers all the features necessary to make new versions available to users, being smart enough not to conflict with any running services.

If you think your application will behave unexpectedly during an upgrade, you need to reproduce this error and post the code and exception here.

I recommend not trying to reinvent the wheel and use the Play Store.

    
12.03.2014 / 16:16
1

You can download the apk and have it install normally:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivityForResult(intent, RC_INSTALL);

Or you can create an app that loads with a new .apk and installs with the same code above, should only be tested in case of update (because installation works).

    
14.04.2014 / 16:00