Actually i need to show badge in app icon but i don't know how to get badge and why onMessageReceived not call when app is in background or app is not running.
public class Custom_FirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FirebaseMsgService";
String activityName;
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage == null)
return;
if (remoteMessage.getNotification() != null) {
Log.i(TAG, "Notification Body: " + remoteMessage.getNotification().getBody());
}
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.i(TAG, "Data Payload: " + remoteMessage.getData().toString());
try{
//boolean from_bg = Boolean.parseBoolean(remoteMessage.getData().get("from_bg").toString());
Map<String, String> data = remoteMessage.getData();
boolean show_fg = Boolean.parseBoolean(data.get("show_fg"));
.....