1

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

  1. Generated Release SHA-1 and SHA-256 keys
  2. Add them in firebase console
  3. Also added Google console app-signing SHA-1 and SHA-256 keys in firebase
  4. Then download the Google-services.json file and add it in app module

enter image description here enter image description here

mr. groot
  • 181
  • 1
  • 13

3 Answers3

2

You have not added your SHA-1 key for the release to your firebase console and hence not existing in your google-services.json.

  1. Generate your SHA-1 for release
  2. Add your release SHA-1 to firebase console
  3. Download and use new 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

1

Have you got SHA-1 key from right jks file path ?

Priyanka Rajput
  • 1,387
  • 1
  • 4
  • 11
1

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.

mr. groot
  • 181
  • 1
  • 13