1

For some reason Fitness.requestPermissions(permissions).then((authorized) => { console.log(authorized) } always returns false. Also in documentation it says it permissions should be:

const permissions = [
    { kind: Fitness.PermissionKind.Step, access: Fitness.PermissionAccess.Read },
];

But the output of console.log(Fitness.PermissionKind, Fitness.PermissionAccess) is:

{"Activity": 2, "Calories": 3, "Distance": 1, "HeartRate": 4, "Step": 0} {"READ": 0, "WRITE": 1}

The Fitness.PermissionAccess.Read has appercase keys {"READ": 0, "WRITE": 1}

Any idea why Fitness.requestPermissions([{kind:0, access: 0}]) (Fitness.PermissionKind.Step and Fitness.PermissionAccess.READ) always fails? It does show a pop up where I can select an ccount, but then permission is still not granted.

user2626972
  • 539
  • 2
  • 7
  • 14

1 Answers1

0

You must have created the Client ID with the wrong debug.keystore, not the one provided with the React Native android project. You can get correct SHA-1 key using this command in android/app folder of react-native project:

keytool -keystore path-to-debug-or-production-keystore -list -v

If this asks for the password, you can get the password from build.gradle file.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83