HealthPermissionsRequestContract


public final class HealthPermissionsRequestContract extends 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 methods

@NonNull Intent

Creates an intent to request HealthConnect permissions.

@NonNull Set<@NonNull String>
parseResult(int resultCode, Intent intent)

Converts the activity result into a Set of granted permissions.

Inherited methods

From androidx.activity.result.contract.ActivityResultContract
ActivityResultContract.SynchronousResult<@NonNull Set<@NonNull String>>
getSynchronousResult(
    @NonNull Context context,
    @NonNull Set<@NonNull String> input
)

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
public HealthPermissionsRequestContract(@NonNull String providerPackageName)

Public methods

createIntent

Added in 1.1.0-alpha10
public @NonNull Intent createIntent(@NonNull Context context, @NonNull Set<@NonNull String> input)

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

Parameters
@NonNull Context context

the context

@NonNull Set<@NonNull String> input

the health permission strings to request permissions for

See also
createIntent

parseResult

Added in 1.1.0-alpha10
public @NonNull Set<@NonNull StringparseResult(int resultCode, Intent intent)

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

See also
parseResult