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;
    }