Skip to content

Commit cb2e3b8

Browse files
committed
Add docs for reading data in background
1 parent 3c99c1d commit cb2e3b8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/health/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,17 @@ List<HealthDataPoint> points = ...;
311311
points = health.removeDuplicates(points);
312312
```
313313

314+
### Android: Reading Health Data in Background
315+
Currently health connect allows apps to read health data in the background. In order to achieve this add the following permission to your `AndroidManifest.XML`:
316+
```XML
317+
<!-- For reading data in background -->
318+
<uses-permission android:name="android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND"/>
319+
```
320+
Furthermore, the plugin now exposes three new functions to help you check and request access to read data in the background:
321+
1. `isHealthDataInBackgroundAvailable()`: Checks if the Health Data in Background feature is available
322+
2. `isHealthDataInBackgroundAuthorized()`: Checks the current status of the Health Data in Background permission
323+
3. `requestHealthDataInBackgroundAuthorization()`: Requests the Health Data in Background permission.
324+
314325
## Data Types
315326

316327
The plugin supports the following [`HealthDataType`](https://pub.dev/documentation/health/latest/health/HealthDataType.html).

0 commit comments

Comments
 (0)