Внутри класса FirebaseMessagingService вы можете получать контент из уведомлений pu sh и создавать свои собственные уведомления
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Notification notification = remoteMessage.getNotification()
String title = notification.getTitle()
String body = notification.getBody();
//now you can build and show your own notification
}
с помощью метода .setContentIntent()
, где вы можете установить любое действие, которое хотите запустить.
NotificationCompat.Builder builder = ...
Intent intent = new Intent(context, destinationClass);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent,
0);
builder.setContentIntent(contentIntent);