-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing permissions on targetSdk 33 #212
Comments
I think I know how it's happening, but could you add some text to explain how to reproduce apart from the stacktrace. |
I have run this demo on a Samsung Watch 5, (Android OS version 13, and Wear OS version 4.0) |
OK, it's working on emulator if you grant all permissions. But does fail if you deny. So looks like a different issue than I guessed. |
Please see the video... PXL_2.mp4 |
@dharmraj2018 Thanks for the video. I can't reproduce on Pixel Watch 2 or the API 33 emulator. I don't have access to GW4 at the moment. Can you share your Health Services version? $ adb shell dumpsys package com.google.android.wearable.healthservices | grep versionCode
versionCode=1443860 minSdk=30 targetSdk=33
versionCode=1405199 minSdk=30 targetSdk=33 |
Hi @ithinkihaveacat please check the version. let me know if anything needs to upgrade version. |
@ithinkihaveacat I think there are multiple parts here
|
I'm having trouble reproducing the behavior shown in the video at #212 (comment). Things I tried:
|
Linking here the docs for which permissions are needed - https://developer.android.com/health-and-fitness/guides/health-services/permissions |
Hi @yschimke @ithinkihaveacat do you have any updates for me? |
@dharmraj2018 I'm struggling to reproduce this :-(. Tried another GW device just now and it works just fine. (Granting all permissions for now, as in #212 (comment).) It also works on the emulator. Can you reproduce on a different device? |
Hi @ithinkihaveacat , I have been able to run the app on the simulator successfully. However, I'm encountering issues when trying to run it on actual Samsung Watch 4 and 5 devices with the latest software version. Previously, it was working fine, but after updating the watch to One UI 5.0 (System version: 13 and Wear OS version 4.0), the app is not functioning properly, and I'm experiencing the same crash. Please assist in resolving this issue. |
@dharmraj2018 can you post the results of this command:
Double check that the package is actually com.example.exercise, change it if its different. |
@dharmraj2018 I think this should solve your issue #223, looks like the exercise sample was missing the POST_NOTIFICATION permission, you only need to request this on Wear 4, which explains why you only say this after updating, see: https://developer.android.com/training/wearables/versions/4/changes#notification-permission |
I'm unclear how this manifest as
If really required, we should add to https://developer.android.com/health-and-fitness/guides/health-services/permissions |
Hi @amankhoza
|
Is our sample missing BODY_SENSORS_BACKGROUND ? |
@dharmraj2018 I was going to suggest the same as @yschimke, looking at the permissions you've mentioned in #212 (comment) the only one missing from https://developer.android.com/health-and-fitness/guides/health-services/permissions is BODY_SENSORS_BACKGROUND. This should only be necessary if you're using a PassiveMonitoring client or want to collect sensor data in the background, but regardless, try adding it to the REQUIRED_PERMISSIONS array in |
Hi @amankhoza I already checked with having permission for BODY_SENSORS_BACKGROUND still crashing the same issue although Google Pixel Watch 2 is working fine without this permission. The problem is only with the Samsung watch One UI 5.0 |
Ok @dharmraj2018 a few more ideas:
Now click start and see what is printed in the logcat, this might help us narrow down if the app is losing a permission at runtime. Paste the results back here.
Report the new versionCode here, then repeat steps in 1)
|
Thanks, @amankhoza! I've identified the issue; it seems that GPS was not enabled, leading to the crash on the Samsung watch. I resolved the problem by enabling the location before starting an exercise, and now the crash has been fixed. |
That sounds like a bug we could easily reproduce and fix. |
Hello 👋
I configured:
While running the app I ended up with:
After looking into health-services permissions |
If an exercise is started with incorrect permissions or location is disabled and it is being requested, WHS throws an exception, this was not being handled in HealthServicesRepository which resulted in a crash when calling startExercise. This change catches the error and displays it in an error screen. Implemented in ExerciseScreen to avoid having to reimplement the error catching logic since starting an exercise is called from multiple places. Prevents crashes like the one seen in android#212.
@monteiro-renato improving the exception has been raised internally, feel free to raise it as a public issue here if you want to keep track or get others to upvote etc. https://issuetracker.google.com/issues/new?component=1056301&template=1581114 In terms of the crash, I added a PR to prevent it for ExerciseSampleCompose in #231, something similar can probably be done for ExerciseSample. |
If an exercise is started with incorrect permissions or location is disabled and it is being requested, WHS throws an exception, this was not being handled in HealthServicesRepository which resulted in a crash when calling startExercise. This change catches the error and displays it in an error screen. Implemented in ExerciseScreen to avoid having to reimplement the error catching logic since starting an exercise is called from multiple places. Prevents crashes like the one seen in android#212.
I am facing similar issue. Getting same Missing Permission error, but I alraedy have ACTIVITY_RECOGNITION permission there, and other 4. Now I dont know which permission is missing... |
I am facing similar issue: https://stackoverflow.com/questions/79103144/wearos-startexercise-is-giving-missing-permission-error |
Hey @gitusman If you're using ExerciseSample, can you make sure you have Location enabled on the device? In the emulator this is, Settings > Location > Use Location. I'm not sure how it appears on Galaxy Watch, but it should be similar. This would be device settings, not the settings of the app. |
@breanatate Yes I am using the code of ExcerciseSample. Location was not enabled before. But I enabled it from the settings and tried again, still getting the crash |
There is bug with PassiveData sample. Without |
FATAL EXCEPTION: main
Process: com.example.exercise, PID: 13281
java.lang.SecurityException: Missing permissions
at androidx.health.services.client.impl.internal.StatusCallback.onFailure(StatusCallback.kt:43)
at androidx.health.services.client.impl.internal.IStatusCallback$Stub.onTransact(IStatusCallback.java:74)
at android.os.Binder.execTransactInternal(Binder.java:1285)
at android.os.Binder.execTransact(Binder.java:1244)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@d760ae4, Dispatchers.Main.immediate]
The text was updated successfully, but these errors were encountered: