A few days ago I implemented FB Login to my APP, and today I found out that most of the things I have implemented are now deprecated.
Before, I was using Sess
I got it!
First, make sure you have initialized your FB SDK. Second, add the following:
accessTokenTracker = new AccessTokenTracker() {
@Override
protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken newAccessToken) {
updateWithToken(newAccessToken);
}
};
This will be called when there's a change on the Current Access Tokes. Meaning, this will only help you if the user is already logged in.
Next, we add this to our onCreate() method:
updateWithToken(AccessToken.getCurrentAccessToken());
Then of course, our updateWithToken() method:
private void updateWithToken(AccessToken currentAccessToken) {
if (currentAccessToken != null) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashScreen.this, GeekTrivia.class);
startActivity(i);
finish();
}
}, SPLASH_TIME_OUT);
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashScreen.this, Login.class);
startActivity(i);
finish();
}
}, SPLASH_TIME_OUT);
}
}
That did it for me! =]