I can not open a message sent by firebase

0

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

    
asked by anonymous 06.12.2017 / 15:09

1 answer

0
 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())
    
06.12.2017 / 16:37