【发布时间】:2011-03-31 18:38:06
【问题描述】:
我有一个为我的公司编写的 android 应用程序,因为它是一个私有应用程序,所以它不在 android 市场上。我希望能够让应用定期检查更新,如果有更新,请通知用户并开始下载/安装更新。
有这样的例子吗?
【问题讨论】:
标签: android auto-update
我有一个为我的公司编写的 android 应用程序,因为它是一个私有应用程序,所以它不在 android 市场上。我希望能够让应用定期检查更新,如果有更新,请通知用户并开始下载/安装更新。
有这样的例子吗?
【问题讨论】:
标签: android auto-update
在您的应用启动时检查可用版本,您可以使用 AlertDialog 请求升级。
阅读这个:: Is there a way to automatically update application on Android?
这是一个 AlertDialog 示例::
if (ConfigXML_app_version> myapp_version){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Upgrade");
builder.setMessage("Update available, ready to upgrade?");
builder.setIcon(R.drawable.icon);
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(app_link));
startActivity(intent);
finish();
}
});
builder.setNegativeButton("Nop", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
【讨论】:
Pushlink (https://www.pushlink.com) 旨在让您的企业应用程序在没有第三方库的情况下自行更新。您还可以使用一些更新策略,例如状态栏、弹出窗口或已获取根设备的静默更新。
【讨论】: