I need to show notification to user only if application is not in foreground. Here is my public class MyFirebaseMessagingService extends
FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if(applicationInForeground()) {
Map<String, String> data = remoteMessage.getData();
sendNotification(data.get("title"), data.get("detail"));
}
}
need to implement applicationInForeground()
method