【问题标题】:Opening particular app on notification click [duplicate]在通知上打开特定应用程序单击 [重复]
【发布时间】:2018-10-03 23:09:25
【问题描述】:

我在通知中收到一个包名称,我想在单击通知后在 Play 商店中打开该特定应用程序。该怎么做呢?

【问题讨论】:

    标签: android firebase firebase-notifications


    【解决方案1】:

    您可以简单地使用隐式意图:

           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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-08
      • 2020-04-04
      • 1970-01-01
      相关资源
      最近更新 更多