I have a strange problem in my app in android. I have done a notification and I want to launch a new activity when notification is clicked. The problems is that when I click on notification nothing happens, and I have no idea where is the problem? Can anyone help me?Here is my code :
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence NotificationTicket = "Notification";
CharSequence NotificationTitle = "Notification";
CharSequence NotificationContent = "Test";
long when = System.currentTimeMillis();
Notification notification = new Notification(R.drawable.icon,
NotificationTicket, when);
Context context = getApplicationContext();
Intent notificationIntent = new Intent(this, ShopsOnMap.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, NotificationTitle, NotificationContent, contentIntent);
notificationManager.notify(NOTIFICATION_ID, notification);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_SINGLE_TOP);
I had the same problem and then realized that I hadn't declared my new activity in the Manifest.
<activity
android:name=".YourActivityHere">
</activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With