I'm having a little problem. I have an AlarmManager who sends an intent to a BroadcastReceiver, in the onReceive
method of that class I push a notification to the StatusBar... This works like a charm, but I need to open an activity when the user taps on the notification, but there is some problem in my code an after googling and searching in SO I couldn't find an answer... so this is my code to push the notif:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClass(this.context, NewCommit.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent sender = PendingIntent.getBroadcast(this.context, 192839, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder noti = new NotificationCompat.Builder(this.context)
.setSmallIcon(R.drawable.status_bar_icon)
.setContentTitle("My notification")
.setContentText("Hello World!")
.setContentIntent(sender);
noti.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(181818, noti.build());
Any idea?? It's driving me crazy!
Thanks!