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?

noogui
  • 15,376
  • 3
  • 18
  • 42

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
  • 10,934
  • 3
  • 27
  • 44