quiero abrir desde una notificacion el acitivity main y otro dependiendo de un parametro pero solo puedo abrir el pricipal y al recibir notificaciones con la app abierta esta se cierra el codigo es el siguiente.
private void enviarNotificacion(RemoteMessage.Notification messageBody) {
Intent intent;
Notification notificacion;
if(messageBody.getClickAction().compareTo(null)==0){
intent = new Intent(getApplicationContext(),MainActivity.class);
}else{
intent = new Intent(getApplicationContext(),MostrarWeb.class);
}
PendingIntent pendingIntent =
PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
Uri defaultSoundUri=
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notificacion = new NotificationCompat.Builder(this)
.setSmallIcon(getResources().getIdentifier(messageBody.getIcon(),
"drawable", getApplicationContext().getPackageName()))
.setLargeIcon(BitmapFactory.decodeResource(getResources(),
R.drawable.ic_noti))
.setContentTitle(messageBody.getTitle())
.setContentText(messageBody.getBody())
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
.build();
NotificationManager notificationManager =
(NotificationManager)
getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0,notificacion);}