Reputation: 374
I am trying to send FCM
notifications (between users on sending messages, friend requests etc.) in release app which is not receiving but they are sending/receiving very well in debug apk, i have searched about this and found some solutions which are not working for me
like this, I placed it in pro-guard rules but not working
-keep class com.google.firebase.* {*;}
In my AndroidManifest.xml
<service
android:name=".notifications.MyFirebaseMessaging"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".notifications.MyFirebaseInstanceId"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
and other dependencies, I am not including them here as the app is work fine in debug mode
Edited
I already have
Upvotes: 4
Views: 8668
Reputation: 374
Well i found the solution of the problem by my own during brushing my teeth last night. both the answers helped me a lot by guiding me that i need a SHA keys for the release version as i don't know about them so they are very helpful for me.
I have successfully generated SHA keys and store them in firebase console but the notifications was still not working, so i observe that i did not allow to access firebase notification services by the Proguard Rules
so i just add this line there
-keepclassmembers class com.example.app.notifications.* {
*;
}
Now it is working magically.
Upvotes: 4
Reputation: 130
You have not added your SHA-1 key for the release to your firebase console and hence not existing in your google-services.json.
If you're using Google play app-signing. Make sure the key being used by play store to sign your releases is also added in step 2
Upvotes: 8