You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, Health Connect restricts read data to 30 days from when permission has been granted.
78
+
79
+
You can check and request access to historical data using the `isHealthDataHistoryAuthorized` and `requestHealthDataHistoryAuthorization` methods, respectively.
80
+
81
+
The above methods require the following permission to be declared:
Accessing fitness data (e.g. Steps) requires permission to access the "Activity Recognition" API. To set it add the following line to your `AndroidManifest.xml` file.
Copy file name to clipboardExpand all lines: packages/health/lib/src/health_plugin.dart
+64Lines changed: 64 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -200,6 +200,70 @@ class Health {
200
200
}
201
201
}
202
202
203
+
/// Checks if the Health Data History feature is available.
204
+
///
205
+
/// See this for more info: https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_HEALTH_DATA_HISTORY()
206
+
///
207
+
///
208
+
/// Android only. Returns false on iOS or if an error occurs.
'$runtimeType - Exception in isHealthDataHistoryAvailable(): $e');
219
+
returnfalse;
220
+
}
221
+
}
222
+
223
+
/// Checks the current status of the Health Data History permission.
224
+
/// Make sure to check [isHealthConnectAvailable] before calling this method.
225
+
///
226
+
/// See this for more info: https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_HEALTH_DATA_HISTORY()
227
+
///
228
+
///
229
+
/// Android only. Returns true on iOS or false if an error occurs.
'$runtimeType - Exception in isHealthDataHistoryAuthorized(): $e');
240
+
returnfalse;
241
+
}
242
+
}
243
+
244
+
/// Requests the Health Data History permission.
245
+
///
246
+
/// Returns true if successful, false otherwise.
247
+
///
248
+
/// See this for more info: https://developer.android.com/reference/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_HEALTH_DATA_HISTORY()
249
+
///
250
+
///
251
+
/// Android only. Returns true on iOS or false if an error occurs.
0 commit comments