android - 在通知点击时打开特定应用程序

标签 android firebase firebase-notifications

<分区>

我在通知中收到了一个包名称,我想在单击通知后在 Play 商店中打开该特定应用程序。如何进行?

最佳答案

您可以简单地使用隐式 Intent :

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

关于android - 在通知点击时打开特定应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49988972/

相关文章:

android - 应用程序运行时不显示 Firebase 通知

android - 如何使用Firebase数据库和Firebase通知为聊天应用程序构建通知系统

android - 如何在应用程序为后台 FCM 时检索通知消息 intent.getExtras()

android - RecyclerView 不显示任何内容

java - 在 Firebase 中自动增加一个值

android - 有什么方法可以将图标添加到 Snackbar?

firebase - 是否有可能通过内部功能访问 firebase admin?

javascript - 如何将单个对象的对象转换为对象数组?

java - AIDL服务和Android开源

android - 服务中的唤醒锁实现