1

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?

Unheilig
  • 16,196
  • 193
  • 68
  • 98
nano
  • 53
  • 6

1 Answers1

1

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.!

Community
  • 1
  • 1
Deep Mehta
  • 1,250
  • 1
  • 16
  • 29
  • thank you for response but i ask about "localStorage.isSignInned" it's need a plugin and how can i use it – nano Jun 10 '15 at 10:45
  • second thing :how i can get last access token after closing my app?? – nano Jun 10 '15 at 10:48
  • localStorage is by default supported by all browsers. both facebook and google+ api have way of knowing access token. you will find if you check their documentation. – Deep Mehta Jun 10 '15 at 13:47