Android Sanaullah
Android Sanaullah

Reputation: 141

Unable to subscribe to topic Firebase Android

'''public void subscribeToTopic(String topic){
    FirebaseMessaging.getInstance().subscribeToTopic(topic)
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    String msg = "subscribed to topic \""+topic+"\"";
                    if (!task.isSuccessful()) {
                        msg = "msg_subscribe_failed";
                    }
                    Log.d(TAG, msg);

                    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
                }
            });
}'''

Logcat

E/FirebaseMessaging: Topic operation failed: SERVICE_NOT_AVAILABLE. Will retry Topic operation.

Upvotes: 1

Views: 1494

Answers (1)

DIGI Byte
DIGI Byte

Reputation: 4163

This can be caused by MANY potential issues, including files in the wrong directory, lack of internet connection, outdated Google play packages, and missing in the manifest.

I suggest checking out all the answers here: FirebaseCloudMessaging : FirebaseInstanceId background sync failed - SERVICE_NOT_AVAILABLE

and let's debug from there.

Upvotes: 2

Related Questions