everybody, I m using firebase to receive a push notification from the server. Everything working fine when the application is running. I got the notification, I handle it and show it over notification tray. Seems perfect. Here is my code.
public class FirebasePushService extends FirebaseMessagingService {
private static final String TAG = "FireBase main service ";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "Got Message: " + remoteMessage.getFrom());
try {
if (remoteMessage != null && remoteMessage.getNotification() != null
&& remoteMessage.getNotification().getBody() != null) {
String body = remoteMessage.getNotification().getBody();
Log.d(TAG, "From: " + remoteMessage.getFrom());
Log.d(TAG, "Notification Message Body: " + body );
}
} catch (JSONException e) {
e.printStackTrace();
}
}}
Manifest code.
<service android:name="app.asparagus.com.asparagus.firebase.FirebasePushService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
. The issue is when the application is closed. No log works of this class, nothing. But here is the interesting part. I can see the whole JSON from the server, and it is shown on notification tray ( whole JSON object is displayed). Really not getting what's wrong in my code. Check the image.
1- The success case.