revokeAllPermissions
Revokes all previously granted permissions by the user to the calling app.
The revocation does not take effect until the app restarts
This is a documented Health Connect platform limitation, not a bug in this library. After calling revokeAllPermissions(), the running process keeps behaving as if the permissions were still granted:
getGrantedPermissionskeeps returning the revoked permissions.- Reads and writes keep succeeding, and written data really is persisted.
The permissions are only actually revoked once the app process is restarted.
Because of this, do not use revokeAllPermissions() as the mechanism behind an in-app "disconnect from Health Connect" toggle — the user will turn it off and your app will keep syncing. Instead:
- Send the user to Health Connect to revoke there, using
openHealthConnectSettings. - If you do call
revokeAllPermissions(), tell the user the change takes effect after restarting the app. - Track the "disconnected" state in your own app and stop reading and writing yourself, rather than relying on Health Connect to start rejecting your calls.
See Google's guidance on the "Sync with Health Connect" toggle.
Method
revokeAllPermissions(): Promise<void>
Example
import { revokeAllPermissions } from 'react-native-health-connect';
// ...
revokeAllPermissions();