My notifications fires very well, but my problem is that, when I click on notification in Notification Center, it does not start my Activity which one is open for app.
Basically, after clicking on my notification its open Mainactivity but i want to open some another pages from my application.
when my app is in foreground and notification arrived its open perfect page but when application is not in foreground it's open Mainactivity
so please tell me what should i can do for that..?
private void sendNotification(String body) {
if (body.equals("Image Upload Successfully")){
intent= new Intent(this, Image_Gallery.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}else if (body.equals("Video Upload Successfully")){
intent = new Intent(this, Video_Gallary.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}else if (body.equals("Home Work Are Uploaded")){
intent = new Intent(this, HomeWork.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}else if (body.equals("Daily Work Are Uploaded")){
intent = new Intent(this, DailyDairy.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}else if (body.equals("Upcomming Holiday")){
intent = new Intent(this, Events.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}else if (body.equals("New Event Are Uploaded")){
intent = new Intent(this, Events.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
PendingIntent pendingIntent = PendingIntent.getActivity(this, not_nu, intent, PendingIntent.FLAG_ONE_SHOT);
//Set sound of notification
Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notifiBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Notificaton")
.setContentText(body)
.setAutoCancel(true)
.setVibrate(v)
.setSound(notificationSound)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(not_nu , notifiBuilder.build());
}