HealthPermissionsRequestContract


class HealthPermissionsRequestContract : ActivityResultContract


An ActivityResultContract to request Health permissions.

It receives a set of permissions as input and returns a set with the granted permissions as output.

Summary

Public constructors

Public functions

open Intent
createIntent(context: Context, input: Set<String>)

Creates an intent to request HealthConnect permissions.

open Set<String>
parseResult(resultCode: Int, intent: Intent?)

Converts the activity result into a Set of granted permissions.

Inherited functions

From androidx.activity.result.contract.ActivityResultContract
open ActivityResultContract.SynchronousResult<Set<String>>?
getSynchronousResult(context: Context, input: Set<String>)

An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.

Public constructors

HealthPermissionsRequestContract

Added in 1.1.0-alpha10
HealthPermissionsRequestContract(
    providerPackageName: String = HealthConnectClient.DEFAULT_PROVIDER_PACKAGE_NAME
)

Public functions

createIntent

Added in 1.1.0-alpha10
open fun createIntent(context: Context, input: Set<String>): Intent

Creates an intent to request HealthConnect permissions. It receives as input a Set of HealthConnect permissions.

Parameters
context: Context

the context

input: Set<String>

the health permission strings to request permissions for

See also
createIntent

parseResult

Added in 1.1.0-alpha10
open fun parseResult(resultCode: Int, intent: Intent?): Set<String>

Converts the activity result into a Set of granted permissions. This will be a subset of Set passed in createIntent.

See also
parseResult