In my App i have used the Facebook SDK 3.14. Now i made an upgrade to 4.4.0 and i have to initialize the AccessToken and Profile objects for users which were logged in.
if(AccessToken.getCurrentAccessToken()==null) {
String tempAccessToken = Preferences.getPreference(_context, PREFERENCES_FACEBOOK_ACCESS_TOKEN, null);
if (tempAccessToken != null) {
String tempUserID = Preferences.getPreference(_context, PREFERENCES_FACEBOOK_ID, null);
AccessToken.setCurrentAccessToken(new AccessToken(tempAccessToken,_context.getString(_resourceAppID),tempUserID,null,null,null,null,null));
Profile.fetchProfileForCurrentAccessToken();
Preferences.removePreference(_context, PREFERENCES_FACEBOOK_ID);
Preferences.removePreference(_context,PREFERENCES_FACEBOOK_ACCESS_TOKEN);
}
}
To initialize it correctly i use the saved AccessToken and FacebookUserID. By some users the method Profile.getCurrentProfile() returns null after this process.
Has anyone an idea why this happens?