Recently I am going to work on a project in which the requirement is little weird. I am asked to develop a app which will not be uploaded to any marketplace like playstore or any other android app stores. It will be simply uploaded in cloud to distribute the APK among users.
After the app is being installed on user device, when a new version will be released, the user will be notified (notified not to download the new version and re-install, but to grant permission and update). After the user grant permission, the app will be updated. What's the best way to do this without the marketplace help?
My idea:
- Use GCM (Google Cloud Messaging) to notify user and give a new version link.
- User will click on the link and a new version will be downloaded and replaced the previous one (android by-default version replacement)
Is there any smarter way to do what I want to achieve actually?
The best way to do this I have found, was to host the apk and a text file with the latest version #.
Opon opening the app, check the current v # against the one hosted on the server, if they dont match, grab the new one.
No need for pushing anything unless your app works as a background service and you need to ensure that whether the user is on the latest version whether they use it or not.
If that is the case, you can have a service that does it once a day or something like that.
EDIT - after downloaded, to install the apk, use the following code.
Install Application programmatically on Android
I did a small amount of digging and found a library that does exactly this. I have not used it, but it popped up in some other related SO questions.
https://github.com/RaghavSood/AppaholicsUpdateChecker
Here is some of the code I use for this purpose. You will have to adjust some as I am too lazy to strip it down atm. (sorry).
So, in onCreate of my Activity I have:
And the code to check for and fetch latest version (+launch installer).