Firebase cloud messaging(FCM) not working on android version below kitkat (4.4)

2.9k Views Asked by At

I have implemented FCM as per documentation and it is working perfectly on android versions 4.4(Kitkat) and above and not working on 4.3(Jelly Bean) and below versions. As per FCM documentation it says the minimum version required is 4.0 with play services which I have. FCM is generating refresh token and when I use it to send message from my server or FCM console it is not working. Below is my Manifest entries for FCM.

Firebase documentation

     <service android:name=".service.RMFirebaseInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
    <service android:name=".service.RMFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

Any suggestion is appreciated. Thanks.

1

There are 1 best solutions below

0
Bhojaviya Sagar On

Use latest google-services plugin.

In Top-level build.gradle do changes

buildscript {
// ...
dependencies {
  // ...
  // Add the following line:
  classpath 'com.google.gms:google-services:4.2.0'  // Google Services plugin
}

}

allprojects {
// ...
repositories {
  // Check that you have the following line (if not, add it):
  google()  // Google's Maven repository
  // ...
}

}

In Modual level build.gradle file do changes

 // Add the following line to the bottom of the file:
 apply plugin: 'com.google.gms:google-services'  // Google Play services Gradle plugin