Пример #1
0
 /**
  * Instantiate the facebook session
  *
  * @param APP_ID
  * @param context
  * @return
  */
 public static Facebook instantiateSession(String APP_ID, Context context) {
   Facebook facebook = new Facebook(APP_ID);
   restore(facebook, context);
   SessionListener listener = new SessionListener(context);
   FacebookSessionEvents.addAuthListener(listener);
   FacebookSessionEvents.addLogoutListener(listener);
   return facebook;
 }
Пример #2
0
 /**
  * Request the logout for the current facebook session
  *
  * @param activity
  */
 public static void logoutRequest(Activity activity) {
   Facebook mFb = FacebookProvider.getFacebook();
   if (mFb.isSessionValid()) {
     FacebookSessionEvents.onLogoutBegin();
     AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFb);
     asyncRunner.logout(activity, new LogoutRequestListener(activity));
   }
 }
Пример #3
0
 @Override
 public void onCancel() {
   FacebookSessionEvents.onLoginError(context.getString(R.string.share_facbook_action_canceled));
 }
Пример #4
0
 @Override
 public void onError(DialogError error) {
   GuiUtils.error(TAG, null, new RuntimeException(error), context);
   FacebookSessionEvents.onLoginError(error.getMessage());
 }
Пример #5
0
 @Override
 public void onFacebookError(FacebookError error) {
   GuiUtils.error(TAG, null, error, context);
   FacebookSessionEvents.onLoginError(error.getMessage());
 }
Пример #6
0
 @Override
 public void onComplete(Bundle values) {
   FacebookSessionEvents.onLoginSuccess();
   GuiUtils.info(R.string.share_facebook_success_setup_message);
 }