Permission

Indicates the unit of permission to obtain the user's consent to share their data with the Samsung Health app's data store.

Each permission is granted for a pair of DataType and specific AccessType. A sample code for obtaining a reading permission for a data type is as follows:

val store = HealthDataService.getStore(context)
val requiredPermissions = HashSet(
    listOf(Permission.of(DataTypes.STEPS, AccessType.READ))
)
// Check if permission was already granted:
val grantedPermissions = store.getGrantedPermissions(requiredPermissions)
if (!grantedPermissions.containsAll(requiredPermissions)) {
    //Ask for permission if it was not granted before:
    val requestResult = store.requestPermissions(requiredPermissions, activity)
    if (!requestResult.containsAll(requiredPermissions)) {
        // Process permission denial
    }
}

Since

1.0.0

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The access type of this permission.

Link copied to clipboard

The data type for which the permission is required.

Preferences Submitted

You have successfully updated your cookie preferences.