- Home /
Facebook auto login the user,Auto Login To facebook
Hello guys .. I am facing a problem with facebook unity sdk. I have a button for logging in to facebook. That button is checking whether the (fb.logggedin) if true I will remove that button. the problem is when the user close the game .. how can the game remember the that user was logged in the (fb.loggedin) property return false. thanks in advaance,Hello Guys.. I am facing a problem with a facebook unity sdk.. the problem is . How can I keep the user logged in to facebook after he colsed the game, I have a button which let the user log in to facebook ,, that button ask the facebook whether if (fb.loggedin) is true or false. in true case the button will be removed, the problem is (fb.loggedin) return false when the user close the app.. I am using 7.9.4 sdk unity 2017.2.1p4 Thanks in advance
Answer by Mehul-Rughani · Jan 23, 2018 at 09:40 AM
Hello,@MHDKH
User PlayerPrefs to store whether user was logged in with facebook or not. ForExample:
Store
PlayerPrefs.SetInt("IsLoggedInWithFacebook",1);
when user logged in with facebook successfully and then when next time user come back to your game check this
if(PlayerPrefs.GetInt("IsLoggedInWithFacebook",0)==1)
{
//Previously Logged In With Facebook
}
else{
//Previously Not Logged In With Facebook
}
Hope you are looking for this.