Android facebook sdk 4.0 ProfileTracker onCurrentProfileChanged never called

I am trying to track a user profile using the ProfileTracker class using the new sdk for Facebook 4.5. When a user connects to Facebook in my application (and the built-in Facebook application on the device), it automatically starts with the current user account in its own application. But now, if a user logs out of their own Facebook application on the device and logs in with a different user account than the previous one. I want my application to receive a notification that the user has now changed their account / profile in the native application. To ensure that I use the following code:

protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); setContentView(R.layout.activity_homescreen); uIint(); LoginManager.getInstance().registerCallback(callbackManager, this); profileTracker = new ProfileTracker() { @Override protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) { if (oldProfile != null) { Log.i(getClass().getSimpleName(), "profile oldProfile: " + oldProfile.getFirstName()); } if (currentProfile != null) { Log.i(getClass().getSimpleName(), "profile currentProfile: " + currentProfile.getFirstName()); } } }; profileTracker.startTracking(); if(profileTracker.isTracking()) Log.i(getClass().getSimpleName(), "profile currentProfile Tracking: " + "yes"); else Log.i(getClass().getSimpleName(), "profile currentProfile Tracking: " + "no"); } @Override public void onSuccess(LoginResult loginResult) { //Utils.showToast_msg(context, "Login success"); getFbProfileInfo(); } @Override public void onCancel() { Utils.showToast_msg(context, "Login onCancel"); } @Override public void onError(FacebookException e) { Utils.showToast_msg(context, "Login onError"); } 

I log in with an account in my own Fb application, and then successfully connect to fb in my application. Then I exit my own Fb application and register with a different account, but onCurrentProfileChanged is never called to notify me that the profile has stalled. I print a log to check if it tracks the profile, or does not always return true / yes. Any help?

+6
source share

All Articles