2014-09-23 56 views
0

根據我的應用程序概念,我們並未在Play商店中提交應用程序。從通知欄安裝Android應用程序

每當用戶啓動應用程序時,它都會通過Web服務檢查最新的更新。如果服務器中有最新的apk文件,它將被下載到SD卡中的特定路徑。下載過程顯示在通知欄中。這是我的問題。

After download is completed, the notification is shown in Notification bar as "App is completed downloading" with app icon. Now when the user touches the my apps notification i want it to be either installed or need to open the sd card path. How to implement this process 
+0

[編程Android上安裝應用程序(http://stackoverflow.com/questions/4604239/install-application-programmatically-on-android) – 2014-09-23 14:03:32

回答

1

嘗試這種情況:

 Intent install_intent = new Intent(Intent.ACTION_VIEW); 
    install_intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory().getPath() + "/myapp.apk")),"application/vnd.android.package-archive"); 
    PendingIntent pending = PendingIntent.getActivity(YourAcrtivity.this,0, install_intent, 0); 
    notification.setContentIntent(pending); 
+0

的可能重複我應該在哪裏調用上面的代碼!? – 2014-09-24 08:04:07

+0

@SivaK完成下載後。你是如何下載文件的? – 2014-09-24 08:42:22

+0

我明白了,謝謝.... – 2014-09-24 09:30:07