Giter Club home page Giter Club logo

Comments (7)

StasDoskalenko avatar StasDoskalenko commented on July 29, 2024

@sujayjaju hi!
There are two methods to try:

   GoogleFit.isAvailable(callback) // is Google Fit available for this device

    GoogleFit.isEnabled(callback) //is permission granted

from react-native-google-fit.

sujayjaju avatar sujayjaju commented on July 29, 2024

Both don't work if the app is reopened. Always returns false on start.

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on July 29, 2024

@sujayjaju hm. The strange is. IF user already authorized, it shouldn't show the login screen.

from react-native-google-fit.

sujayjaju avatar sujayjaju commented on July 29, 2024

It does not. What I mean is that I need the app to know whether it is already authorized or not. Call "authorize" only if already authorized. Not sure if its even possible.

from react-native-google-fit.

shaheem-khanzada avatar shaheem-khanzada commented on July 29, 2024

hi whats yourn RN version?
you just have to call authorize on componentWillMount() so when ever your app start it automatically check if you are login then authorize function check and move forward to application screen if user is not login then authorize function show login screen like that :]
Example:

componentWillMount() {
this.onAutherize(); // like that
GoogleFit.observeSteps((step)=>{
console.log('step', step);
alert('i am alert step counter')
})
}

onAutherize(){ /// call it on componentWill Mount
GoogleFit.onAuthorize(() => {
});
GoogleFit.onAuthorizeFailure(() => {
alert('something went wrong')
});
GoogleFit.authorize()
// Call when authorized
GoogleFit.startRecording((callback) => {

    });
}

from react-native-google-fit.

StasDoskalenko avatar StasDoskalenko commented on July 29, 2024

@sujayjaju actually it checks on the native side whether user authorized or not. We can't call these methods without basic .authorize() method

from react-native-google-fit.

sujayjaju avatar sujayjaju commented on July 29, 2024

Got it. Thanks for looking into it.

from react-native-google-fit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.