android notification click not working

android, android-notifications

Solution

put

mNotifyMgr.notify(mNotificationId, mBuilder.build()); 

after

mBuilder.setContentIntent(resultPendingIntent);

Problem

I am using this code inside a service in order to get a notification if I have any new alerts but when I click on them I'm not getting to the view that I want: ``` if(newAlertCounter > 0) // alert user about new alerts { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_action_warning) .setContentTitle(newAlertCounter + " new flood alerts!") .setContentText("Tap to see where in your vecinity."); // Sets an ID for the notification int mNotificationId = 001; // Gets an instance of the NotificationManager service NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Builds the notification and issues it. mNotifyMgr.notify(mNotificationId, mBuilder.build()); // notification click action Intent notificationIntent = new Intent(this, ViewAlertsActivity.class); PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); } ``` It shows up but its not clickable, so whats wrong with this?

Original source