This is my class that receives the notification as I can get back the key
that it brings me to then save them automatically when the notification arrives
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
//en este metodo se recibe la notificacion
String from = remoteMessage.getFrom();
String a= remoteMessage.getCollapseKey();
Log.e("DE: ", from);
if (remoteMessage.getNotification().getBody() != null) {
Log.e("CUERPO", remoteMessage.getNotification().getBody());
String p=remoteMessage.getNotification().getTitleLocalizationKey();
System.out.println("prueba_notificaion"+remoteMessage.getNotification().getTitleLocalizationKey());
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
}
if (remoteMessage.getData().size() > 0) {
Log.e("DATA", "DATA" + remoteMessage.getData());
String data= String.valueOf(remoteMessage.getData());
System.out.println("data_data:"+data);
}