home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.23k stars 623 forks source link

Wear OS: Update app to target API 33 by August 30 for play store policy #4500

Closed dshokouhi closed 1 day ago

dshokouhi commented 1 month ago

Skipping the template here.

We need to update Wear OS to API 33 by August 30 or the app wont be updated in the play store after that date.

image

This API level had the requirement for requesting notification permissions which needs to be done during onboarding, amongst other things.

jpelgrom commented 1 month ago

Looking at the behavior changes I only see 2 (documented) items that are relevant for us:

dshokouhi commented 1 month ago

ouch thats not going to be fun regarding teh heart sensor. I remember a feature request for adding the update sensors command to the watch so users can get the heart rate sensor updating more frequently.

dshokouhi commented 2 weeks ago

Regarding the heart rate sensor I just found something specific to Wear OS. Looks like users will be able to grant the app background permission :)

https://developer.android.com/training/wearables/versions/4/changes#background-body-sensor-permission

https://developer.android.com/health-and-fitness/guides/health-services/background-body-sensors

Note: BODY_SENSORS_BACKGROUND is a restricted permission which cannot be held by your app until the installer adds your app to an allowlist, or until the user lets your app have the permission.

or until the user lets your app have the permission. So this must correspond to the "All the time" setting I imagine.

jpelgrom commented 2 weeks ago

I cannot choose all the time after targeting API 33. Is there a manufacturer difference or am I making an error?

dshokouhi commented 2 weeks ago

yea looks like the option is hidden a bit

On Android 13 (API level 33) and higher, the runtime permission dialog doesn't include the "Allow all the time" option. Instead, users must enable all-the-time background sensor access from system settings, as shown in figure 1. When you request the BODY_SENSORS_BACKGROUND permission after granting the BODY_SENSORS permission, you can help users navigate to this settings page. If users decline all-the-time access, they should be able to continue using your app.

https://developer.android.com/health-and-fitness/guides/health-services/background-body-sensors#target-android13-higher

looks like body sensors has to be granted before body sensors background here