开发者

How to control my app's version?

I want to control my customer's app's version. If the application is not update ,i want to show them an alert message that "your app isn't update would you like to update ?" how c开发者_StackOverflow中文版an i control this in android?


You can host your new version apk file in web page with a text file with version information.Then palce a text file in assest with current version information. When you application starts, read current version from assest, download the version information using HTTP methods and compare the version. If you require update then download latest apk from web using HTTP method and install using following code..

Intent apk_installer = new Intent(Intent.ACTION_VIEW);
apk_installer.setDataAndType(Uri.fromFile(apkFilePath),"application/vnd.android.package-archive");
startActivityForResult(apk_installer,0);


You can get current apk/Programm version by:

PackageInfo info = getPackageManager().getPackageInfo(PACKAGE_NAME, 0);
currentVersion = info.versionCode;
currentName = info.versionName;

So you don't really need a local text file with version information.

Greetings Ralf

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜