有人知道如何使用Notification
和PendingIntent
打开Play Store吗?
我想要用我的应用页面打开Play Store,目前已尝试了以下方法。
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());
"https://play.google.com/store/apps/details?id=" + packageName
。 - TheWanderer