使用 PendingIntent 和 NotificationManagerCompat 打开 Play Store
Open Play Store with PendingIntent and NotificationManagerCompat
有人知道如何使用 Notification
和 PendingIntent
打开 Play 商店吗?
I want to open Play Store with my app's page.
Tried this one so far.
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + a.getPackageName()));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(a, 0, i, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(a, "update")
.setContentTitle(getStr(a, R.string.notify_update_title))
.setContentText(getStr(a, R.string.notify_update_body))
.setSmallIcon(R.drawable.ic_notif)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent);
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(a);
managerCompat.notify(UPDATE_NOTIF_ID, builder.build());
我的错。我实际上是在非常低端的智能手机上调试 API 16 我有 Google Play 受损(卸载)因为我需要 Firebase 的 Google Play 服务是最新的。
The surprising thing is that when i tap the notification it doesn't throw ActivityNotFoundException
indicating that Google Play can't be found.
因此在 API 16.
中测试了一个小警告
感谢所有帮助欣赏它的人。
有人知道如何使用 Notification
和 PendingIntent
打开 Play 商店吗?
I want to open Play Store with my app's page. Tried this one so far.
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=" + a.getPackageName()));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(a, 0, i, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(a, "update")
.setContentTitle(getStr(a, R.string.notify_update_title))
.setContentText(getStr(a, R.string.notify_update_body))
.setSmallIcon(R.drawable.ic_notif)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent);
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(a);
managerCompat.notify(UPDATE_NOTIF_ID, builder.build());
我的错。我实际上是在非常低端的智能手机上调试 API 16 我有 Google Play 受损(卸载)因为我需要 Firebase 的 Google Play 服务是最新的。
The surprising thing is that when i tap the notification it doesn't throw
ActivityNotFoundException
indicating that Google Play can't be found.
因此在 API 16.
中测试了一个小警告感谢所有帮助欣赏它的人。