OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
341 stars 68 forks source link

requestPermissions does not ask user for permissions #73

Open geekmidas opened 3 years ago

geekmidas commented 3 years ago

Below is the code that I am using. When I call requestPermissions it does not ask the user for permissions. Please assist


export function useRequestPermissions() {
  const [loading, setLoading] = useState(false);
  const [granted, setGranted] = useState(false);

  useEffect(() => {
    setLoading(true);
    Fitness.requestPermissions(permissions)
      .then(authorized => {
        console.log({ authorized });
        setGranted(authorized);
        setLoading(false);
      })
      .catch(error => {
        console.log({ error });
        setGranted(false);
      });
  }, []);

  return {
    loading,
    granted,
  };
}```
Francesco-Voto commented 3 years ago

Hi @geekmidas do you have some news about this? Typically this kind of problem means some problem in the configuration of the project with maybe a wrong SHA-1. Please also note that the SAH-1 is normally different from debug to release

geekmidas commented 3 years ago

@Francesco-Voto I do not, I struggled and we postponed the feature for later. How did you set yours up?

Francesco-Voto commented 3 years ago

For testing we add the debug SHA1. Typically you can find it in this way keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android.

Remember to change with your production keystore and also test it with a release build.

nikitph commented 3 years ago

this is happening for us too.

yateeshkota commented 3 years ago

hi, I am also facing that issue so I try another library. there I found a comment help i am able to resolve this issue please check. in app/build.gradle.

signingConfigs {
  /* debug {
    storeFile file('...')
    storePassword '...'
    keyAlias '...'
    keyPassword '...'
  } */
  ...
} 

in your_project/android delete debug.keystore after complete this step clean and unsitall app then run again.

https://github.com/StasDoskalenko/react-native-google-fit/issues/215#issuecomment-784046957