If you have apps that are hosted on your server and as time passes you make enhancements, fix bugs, etc. then comes the question how can I alert all my app users that a newer version is out there and make it real easy for them to download. You can email all your users with the link to the new version, that will be very cumbersome. Well that process needs to be built right into the app you deploy it for the first time. Here is an example how to do it, the basic idea is outlined below
1. Create a Web Service which your app can poll whenever the app launches or based on some time limit that can check if there is new version out there.
2. This Web service should return the latest Version of the apk file that is hosted on the Server along with the URI of the application file that has the new version.
3. When your app gets the response from the Web Service, it will parse the JSON and check your app version to the latest version that is available on the server.
4. If your app version is lower than the latest version it will prompt the user to start the download process.
5. The download of the new app is handled by the Download Manager.
6. The download manager will notify your app using Broadcast receiver when the download is complete.
7. Upon completion of the latest version of the application file the you can start the activity to install that file.
8. At this point user needs to say OKAY, lets do it.

Java Servlet Web Service to check New Version – CheckAppVersion.java

Application Manifest file – AndroidManifest.xml
Application Layout file – activity_main.xml
IntentService for making Web Service requests – MyWebService.java
Application Activity – MainActivity.java

Leave a Reply