TAGS :Viewed: 15 - Published at: a few seconds ago

[ get android versionName on server side ]

I want to make my app can do auto-update by comparing version name of my app, I already know how to get my app version name with getPackageInfo.getPackageName, but I don't know how to get app version name from server

I want to make it like this

String versionName = infopackage.versionName;
String serverversion = /*something to get version name from server side*/

    //do nothing

how can I retrieve version name of my app on server side?


I'm not using google play, it's just local app. and if it's possible I want to get app version name on server side directly. I mean without using text file or create a table in my database

Answer 1

First you need to create a table in your database with appversion and appUrl to download the newly created version.Then you need a webservice to get the appVersion and appUrl.

Compare both versionName and serverversion..


Answer 2

  • You need to keep a file on the server side and in that text file, keep a field as versin number.
  • On every update of your app, update the version number in that text file.
  • On the app side, read the read file from the server on app startup. Do JSON parsing to extract the verson field from the text file.
  • If the extracted version number is greater than your current version, give a popup for aap update and redirect to your app in Google Play.