I can send a firebase notification to my App but I can not open that same notification within the actidity responsible for the arrival of this notification
I can send a firebase notification to my App but I can not open that same notification within the actidity responsible for the arrival of this notification
private void createNotification( String messageBody) {
Intent intent = new Intent( this , ResultActivity. class ); // AQUI VC CHAMA A ACTIVITY PARA ENTRAR QUANDO CLICAR NA NOTIFICAÇÃO!
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent resultIntent = PendingIntent.getActivity( this , 0, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri notificationSoundURI = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mNotificationBuilder = new NotificationCompat.Builder( this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("titulo")
.setContentText(messageBody)
.setAutoCancel( true )
.setSound(notificationSoundURI)
.setContentIntent(resultIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, mNotificationBuilder.build());
}
To call the use function
createNotification(remoteMessage.getNotification().getBody())