2

I'm receiving a package name in the notification and I want to open that particular app in play store once I click the notification. How to proceed with that?

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56

1 Answers1

1

You can simply use an implicit 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);
Levi Moreira
  • 11,917
  • 4
  • 32
  • 46