Android ACTIVITY_RECOGNITION Permission SDK 28 running on Android 10/Q (SDK 29)

后端 未结 3 1057
无人及你
无人及你 2021-02-06 05:30

My Android app targets SDK 28 and connects to Google Fit to upload data and read some other data. The app uses the HistoryAPI to read com.google.step_count.delta data.

T

3条回答
  •  旧巷少年郎
    2021-02-06 06:33

    Looks like the documentation was updated: https://developer.android.com/about/versions/10/privacy/changes#physical-activity-recognition

    I was able to solve this by only using the API 28 permission in the manifest (com.google.android.gms.permission.ACTIVITY_RECOGNITION).

    If the app was installed on a device running Android 10 (API 29), the system appears to correctly auto grant the permission android.permission.ACTIVITY_RECOGNITION.

    Because the user can change this in settings (Settings > Apps & Notifications > Permission Manager > Physical Activity > specified app > deny), I was able to check the android.permission.ACTIVITY_RECOGNITION permission if the app was installed on a device running Android 10 (API 29).

提交回复
热议问题