Anyone know how to open Play Store with Notification
and PendingIntent
?
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());
My bad. I was actually debugging on a very low-end smartphone API 16 that i have the Google Play compromised (uninstalled) because i need the Google Play Service up to date for Firebase.
The surprising thing is that when i tap the notification it doesn't throw
ActivityNotFoundException
indicating that Google Play can't be found.
So there is a little caveat tested in API 16.
Thanks to all that helped appreciate it.