Bom dia galera preciso de uma ajuda de vcs

Java

28/03/2017

Bom dia galera, fiz um protótipo de notificação esta funcionando tudo certinho, o que eu não sei fazer é como é mostrar o TEXTO e TITULO da notificação...
Alguém pode me ajuda, como fazer isso.. código abaixo:

public class FcmMessagingService extends FirebaseMessagingService {
    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        String title = remoteMessage.getNotification().getTitle();
        String message = remoteMessage.getNotification().getBody();
        String click_action = remoteMessage.getNotification().getClickAction();

        Intent intent = new Intent(click_action);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendingIntent = PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_ONE_SHOT);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
        notificationBuilder.setContentTitle(title);
        notificationBuilder.setContentText(message);
        notificationBuilder.setSmallIcon(R.mipmap.ic_launcher);
        notificationBuilder.setAutoCancel(true);
        notificationBuilder.setContentIntent(pendingIntent);
        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(0,notificationBuilder.build());

    }
}




Queria mostrar esse TITLE e o MESSAGE, quando a pessoa clicar na notificação ele armazena e ela abre e consegue le o que está escrito..
vlw galera
Fernando

Fernando

Curtidas 0
POSTAR