Skip to content

Commit

Permalink
docs: updated docs for request permission
Browse files Browse the repository at this point in the history
  • Loading branch information
ugurakin1 committed Nov 2, 2024
1 parent 2b71c26 commit d169c26
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion docs/docs/api/methods/03-requestPermission.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Request permission for specified record types and access types.
# Method

```ts
requestPermission(permissions: Permission[], providerPackageName: string): Promise<Permission[]>
requestPermission(permissions: Permission[]): Promise<Permission[]>
```

# Example
Expand All @@ -32,3 +32,28 @@ const requestPermissions = () => {
});
};
```

If your app needs to write exercise routes, can include it as a special permission:

```ts
import { requestPermission } from 'react-native-health-connect';

const requestPermissions = () => {
requestPermission([
{
accessType: 'read',
recordType: 'ExerciseSession',
},
{
accessType: 'write',
recordType: 'ExerciseSession',
},
{
accessType: 'write',
recordType: 'ExerciseRoute'
}
]).then((permissions) => {
console.log('Granted permissions ', { permissions });
});
};
```

0 comments on commit d169c26

Please sign in to comment.