【发布时间】:2018-10-03 23:09:25
【问题描述】:
我在通知中收到一个包名称,我想在单击通知后在 Play 商店中打开该特定应用程序。该怎么做呢?
【问题讨论】:
标签: android firebase firebase-notifications
我在通知中收到一个包名称,我想在单击通知后在 Play 商店中打开该特定应用程序。该怎么做呢?
【问题讨论】:
标签: android firebase firebase-notifications
您可以简单地使用隐式意图:
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);
【讨论】: