Android : PendingIntent not being launched from Notification

on Thursday, December 4, 2014


I've tried about 20 different StackOverflow answers and NONE are working!


Just want to launch an activity from my notification I bring up. It's not working. It isn't doing anything, If I go to my home screen and click on it, it doesn't even bring up the application.


I've added a bunch of stuff since the beginning, so sorry for all the stuff that may not even be needed. I just keep looking through SO and trying solutions.



private void sendNotification(String msg, String cont, String title) {
mNotificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
// this.getSystemService(Context.NOTIFICATION_SERVICE);
Log.d("msg",msg);

int requestID = (int) System.currentTimeMillis();
Intent notificationIntent = new Intent(getApplicationContext(), WalkerRequest.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
Log.d("Intent","setting content intent");
PendingIntent contentIntent = PendingIntent.getActivity(this, requestID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT
| PendingIntent.FLAG_ONE_SHOT);

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.paw_icon)
.setContentTitle(title)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(cont))
.setContentText(cont);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}

0 comments:

Post a Comment