I am handling FCM
notifications in my app. in like
public void onMessageReceived(RemoteMessage remoteMessage) {
Notification notification = new Notification();
notification.setTitle(remoteMessage.getNotification().getTitle());
notification.setDescription(remoteMessage.getNotification().getBody());
DateFormat simpledateFormat = new SimpleDateFormat("dd/MM/yyyy");
DateFormat simpleTimeFormat = new SimpleDateFormat("hh:mm");
Date date = new Date(remoteMessage.getSentTime());
notification.setTime(simpleTimeFormat.format(date));
Date date2 = new Date();
notification.setDate(simpledateFormat.format(date2));
DatabaseHelper databaseHelper = new DatabaseHelper(getApplicationContext());
databaseHelper.saveNotification(notification);
//Calling method to generate notification
sendNotification(remoteMessage.getNotification().getBody());
}
but when app is not running or in background mode i am not able to save those notifications.
i am using "Regular activity" for processing and display of notifications in app.
as said in this link
don't know what i am missing.