I am using this tutorial to implement push notifications using Firebase, but I cannot seem to figure it out. Keeps throwing the error:
FirebaseInstanceId: background sync failed: SERVICE_NOT_AVAILABLE, retry in 40s
I am created a class extending FirebaseMessagingService
and onMessageReceived(..)
. I receive the data. I registered the service in the manifest like:
<!-- [START firebase_service] -->
<service android:name="notifications.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- [END firebase_service] -->
I added latest google-services.json in the root folder of my app. Still, I log nothing.
Naturally, I scoured into StackOverflow to check similar problems. Not many, apparently. Found this, but wasn't very helpful as I still got the same message sent. Any thoughts on something I could have missed?
I tried checking if my device has PlayStore services running and indeed it has:
public boolean isGooglePlayServicesAvailable() {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int status = googleApiAvailability.isGooglePlayServicesAvailable(getApplicationContext());
if (status != ConnectionResult.SUCCESS) {
if (googleApiAvailability.isUserResolvableError(status)) {
googleApiAvailability.getErrorDialog(MainActivity.this, status, 2404).show();
}
return false;
}
return true;
}
Thanks guys, i was able to fix the issue by simply enabling Google playstore services in my phone's Settings > Data plan
I had the same problem. I have found that the problem was with my mobile operator Internet Service. I simply installed A third party VPN app (from Google Play Store) to unblock Google Services.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With