Cordova app check if user signed in before closing my app?

578 views Asked by At

i'am trying to made cordova application that need user login to (google + or Facebook)

so i show button for sign in to (google+ or Facebook) but after i close the app and open it again i need the sign in button hide depending on last signed in account

i need to know how i can check if user signed after closing my application?

ie check if user subscribe with data login to my app or no?

1

There are 1 answers

3
Deep Mehta On

You can check this when your application gets loaded in

function onDeviceReady() {
    // Now safe to use device APIs
    //Create small function which check for is access toke valid or not
    //which returns Boolean true or false
    // Else you can use localStorage.isSignInned and once logged in set it as true.
    if(isSignInned)
    {
        //hide buttons
    }
}

You can check facebook javascript api here and google javascript api here It depends upon how you want your application to work. I am attaching working sample which i created for Facebook for GooglePlus hope this helps.!