我有一個爲我的公司編寫的android應用程序,因爲它是一個私人應用程序,它不在android市場。我希望能夠定期檢查應用程序是否有更新,以及是否有人通知用戶並開始下載/安裝更新。Android應用不在市場中:如何推送更新?
有沒有這樣的例子呢?
我有一個爲我的公司編寫的android應用程序,因爲它是一個私人應用程序,它不在android市場。我希望能夠定期檢查應用程序是否有更新,以及是否有人通知用戶並開始下載/安裝更新。Android應用不在市場中:如何推送更新?
有沒有這樣的例子呢?
在您的應用程序開始時檢查可用版本,您可以使用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)的目的是讓你的企業應用程序更新自身,而不第三方庫。您還可以使用某些更新策略,例如狀態欄,彈出式窗口或無聲更新來查看根設備。
非常感謝! – Mike 2010-08-25 14:33:30
這已經很老了,但是對於每個人的未來參考,當答案解決您的問題時,習慣上將其標記爲接受的答案。 – Erhannis 2014-02-21 21:20:29
這個意圖只下載我的apk的新版本。我需要打開一個安裝彈出 – vimal1083 2014-03-03 06:49:54