在通知点击时打开特定应用程序
Opening particular app on notification click
我在通知中收到了一个程序包名称,我想在单击该通知后在 Play 商店中打开该特定应用程序。如何进行?
您可以简单地使用隐式意图:
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + PACKAGENAME))
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notificationManager.notify(0, notification);
我在通知中收到了一个程序包名称,我想在单击该通知后在 Play 商店中打开该特定应用程序。如何进行?
您可以简单地使用隐式意图:
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + PACKAGENAME))
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notificationManager.notify(0, notification);