第一應用,你需要有一個API如何跟蹤做的用戶版本已經過時了..
例如您發送您的應用程序當前版本的瀏覽器這樣的API:
String version = String.valueOf(BuildConfig.VERSION_CODE);
如果response.body()isUpdateRequired(),所以你需要調用這個阿勒特波紋管是真的:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(SplashActivity.this);
alertDialog.setTitle("Please update your app");
alertDialog.setMessage("This app version is not supported any longer. Please update your app from the Play Store.");
alertDialog.setPositiveButton("UPDATE NOW", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
final String appPackageName = getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
});
alertDialog.show();
如果你的應用是在Play商店,T母雞讓商店處理更新。 –
不幸的是,讓玩商店處理它有主要缺陷。請參閱我對以下答案的評論。 – Ted