Skip to content

FirebaseInstanceId.getInstanceId() failing with SERVICE_NOT_AVAILABLE on WearOS device connected to iPhone #158

@littleariel

Description

@littleariel

Describe your environment

  • Android Studio version: 3.2
  • Firebase Component: Firebase Core & Cloud Messaging
  • Component version:
    firebase_core: "16.0.4",
    firebase_perf: "16.2.0",
    firebase_messaging: "17.3.4",
    firebase_crashlytics: "2.9.6",
    firebase_plugins: "1.1.5",
    firebase_inappmessaging: "17.0.3",
    firebase_config: "16.1.0",

Describe the problem

WearOS devices connected to an iPhone recently started getting SERVICE_NOT_AVAILABLE errors when calling FirebaseInstanceId.getInstanceId(). The exact exception is:

2018-12-07 14:37:26.529 5093-5093/com.xxxxx.xxxxxx E/OurFirebaseActivity: Could not get Firebase token. Exception: java.io.IOException: SERVICE_NOT_AVAILABLE
    java.io.IOException: SERVICE_NOT_AVAILABLE
        at com.google.firebase.iid.zzr.zza(Unknown Source:66)
        at com.google.firebase.iid.zzr.zza(Unknown Source:79)
        at com.google.firebase.iid.zzu.then(Unknown Source:4)
        at com.google.android.gms.tasks.zzd.run(Unknown Source:5)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

This doesn't seem to be specific to our app only, when looking at the device logs, this seems to happen for other apps/services as well.

2018-12-07 14:02:48.931 891-3870/? I/GCM: Registration for wearable paired to iOS
2018-12-07 14:02:48.956 857-857/? D/AltFCMManager: reading APNS_TOKEN dataitem found a null dataitem: 
2018-12-07 14:02:49.107 857-881/? I/zygote: Background concurrent copying GC freed 
2018-12-07 14:02:53.950 891-3870/? W/GCM: Timed out getting APNS token from clockwork
2018-12-07 14:02:53.963 4509-4544/? E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE

Steps to reproduce:

Connect Ticwatch Pro to an iPhone device. Update to the latest WearOS version. Try to call FirebaseInstanceId.getInstanceId() and notice SERVICE_NOT_AVAILABLE.

Note that this Ticwatch Pro device is NOT a China Edition (I'd expect Play Services not to work there), and that we're receiving complaints from users with a wide range of WearOS devices. The only common pattern is that they're all connected to an iPhone, and that it all seems to have started in the past week or so.

Also note that interestingly, we are seeing some internal firebase logs tagged with FA-SVC (analytics?) that show a json bundle uploaded to firebase that DOES include a firebase_instance_id property (some data replace with xxxx for privacy):

2018-12-07 14:13:50.811 1281-4717/? V/FA-SVC: Uploading data. app, uncompressed size, data: com.xxxxxxx.xxxxxxx, 375, 
    batch {
      bundle {
        protocol_version: 1
        platform: android
        gmp_version: 13001
        uploading_gmp_version: 14799
        config_version: 1542996287125120
        gmp_app_id: 1:xxxxxxxx:android:xxxxxxxx
        app_id: com.xxxxxxx.xxxxxxx
        app_version: 2.0.0
        app_version_major: 9999
        firebase_instance_id: fLP7soXXXXX
        dev_cert_hash: XXXXXXXXXXXXX
        app_store: manual_install
        ...

Relevant Code:

firebase.instanceId.addOnSuccessListener {
            Log.d("OurActivity", "Token received: " + it.token);
            SimpleRxBackgroundOp(generateQRBitmap, onBitmapReady, onFailure).execute()
        }

/// always fails there with Exception listed above
        firebase.instanceId.addOnFailureListener() {
            Log.e("OurActivity", "Could not get Firebase token. Exception: " + it);
            onFailure.call(it)
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions