Hi everyone, I am working on improving the adoptio...
# compose-wear
a
Hi everyone, I am working on improving the adoption of my wear app by showing a nudge if a watch is connected to the users Phone, on the Phone app, I am following the process mentioned in Horologist Auth Sample (Phone App) to detect Wear OS watch, but I am facing the following crash whenever Watch’s Companion app is not installed on user’s Phone. The same crash happens in the Horologist Sample as well. Adding a snippet of crash for reference. Can anyone suggest me a approach to handle this crash ?
Copy code
Process: com.google.android.horologist.auth.sample.debug, PID: 31778                                                                                                com.google.android.gms.common.api.ApiException: 17: API: Wearable.API is not available on this device. Connection failed with: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
                                                                                                    	at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(com.google.android.gms:play-services-base@@18.0.1:3)
                                                                                                    	at com.google.android.gms.common.internal.zap.onComplete(com.google.android.gms:play-services-base@@18.0.1:4)
                                                                                                    	at com.google.android.gms.common.api.internal.BasePendingResult.zab(com.google.android.gms:play-services-base@@18.0.1:7)
                                                                                                    	at com.google.android.gms.common.api.internal.BasePendingResult.setResult(com.google.android.gms:play-services-base@@18.0.1:6)
                                                                                                    	at com.google.android.gms.common.api.internal.BaseImplementation$ApiMethodImpl.setFailedResult(com.google.android.gms:play-services-base@@18.0.1:5)
                                                                                                    	at com.google.android.gms.common.api.internal.zae.zad(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zaE(com.google.android.gms:play-services-base@@18.0.1:7)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zaD(com.google.android.gms:play-services-base@@18.0.1:2)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zar(com.google.android.gms:play-services-base@@18.0.1:24)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.onConnectionFailed(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.internal.zai.onConnectionFailed(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.internal.zzf.zzb(com.google.android.gms:play-services-basement@@18.0.0:2)
                                                                                                    	at com.google.android.gms.common.internal.zza.zza(com.google.android.gms:play-services-basement@@18.0.0:3)
                                                                                                    	at com.google.android.gms.common.internal.zzc.zze(com.google.android.gms:play-services-basement@@18.0.0:3)
                                                                                                    	at com.google.android.gms.common.internal.zzb.handleMessage(com.google.android.gms:play-services-basement@@18.0.0:31)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:226)
                                                                                                    	at android.os.Looper.loop(Looper.java:313)
                                                                                                    	at android.os.HandlerThread.run(HandlerThread.java:67)
y
Thanks, we can fix this bug in the sample. Generally, it's checking the availability of the APIs before trying to use the Wearable APIs. They have sharp edges.
a
Thanks @yschimke, this solved my issue. Works perfectly now.
y
a
Thanks for fixing so quickly
103 Views