开发者

How to control my app's version?

开发者 https://www.devze.com 2023-04-06 11:14 出处:网络
Iwant to control my customer\'s app\'s version. If theapplication is not update ,i want to showthem an alert message that \"your app isn\'t updatewould you like to update ?\" howc开发者_StackOverflow中

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

精彩评论

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