Reputation: 391
I am integrating FireBase Push Notification into my application. Although I am receiving push notifications(when application is in background) but my onMessageReceived(RemoteMessage remoteMessage) is never called, independent of whether application is in foreground or backgroud. If its the issue with FCM or there is something that I am doing wrong. I am using 'com.google.firebase:firebase-messaging:9.0.0' in my app build.gradle. I have declared both the services in my application manifest
<service
android:name="app.pnd.camscanner.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name="app.pnd.camscanner.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
Upvotes: 1
Views: 1841
Reputation: 836
The issue for me was that i had tools:node="replace
in the application tag in the manifest
Upvotes: 1
Reputation: 391
Finally, the issue has been resolved. I have created a new project and integrated the firebase again. Now, when the application is in background, I am getting the push automatically and when application is in foreground, my onMessageReceived(remoteMessage) of MyFirebaseMessagingService class which extends FirebaseMessagingService is being called in which I am generating the push notification by myself.
Upvotes: 0