从通知栏安装Android应用程序

时间:2014-09-23 14:00:10

标签: android install apk android-notifications

根据我的应用程序概念,我们不会在Play商店中提交该应用程序。

每当用户启动应用程序时,它都会通过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

1 个答案:

答案 0 :(得分: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);