GeoTecINIT / WearOSSensors

Reliable and concurrent access to smartwatch's sensors
Apache License 2.0
18 stars 4 forks source link

Integrate two-step permissions request workflow #7

Closed matey97 closed 9 months ago

matey97 commented 9 months ago

This PR integrates in the library a two-step permissions request workflow required when requesting special permissions such as BODY_SENSORS_BACKGROUND and ACCESS_BACKGROUND_LOCATION.

Android allows to request several permissions at once. However, special permissions require other permissions to be granted in order to be requested. For example, the BODY_SENSORS permission has to be granted before requesting BODY_SENSORS_BACKGROUND. In other words, a two-step workflow has to be implemented:

  1. Request normal permission.
  2. If granted, request special permission.

This is a non-trivial workflow. Therefore, the library provides the PermissionsRequestHandler, providing functions implementing the workflow.