@Override public void startLogin(Activity activity) { sCallbackManager = CallbackManager.Factory.create(); LoginManager loginManager = LoginManager.getInstance(); loginManager.registerCallback(sCallbackManager, this); List<String> permissionsList = new ArrayList<>(mScopes); // Ensure we have email and public_profile scopes if (!permissionsList.contains(EMAIL)) { permissionsList.add(EMAIL); } if (!permissionsList.contains(PUBLIC_PROFILE)) { permissionsList.add(PUBLIC_PROFILE); } // Log in with permissions loginManager.logInWithReadPermissions(activity, permissionsList); }
public static void registerSharerCallback( final int requestCode, final CallbackManager callbackManager, final FacebookCallback<Sharer.Result> callback) { if (!(callbackManager instanceof CallbackManagerImpl)) { throw new FacebookException("Unexpected CallbackManager, " + "please use the provided Factory."); } ((CallbackManagerImpl) callbackManager).registerCallback( requestCode, new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return handleActivityResult( requestCode, resultCode, data, getShareResultProcessor(callback)); } }); }
/** * Registers a login callback to the given callback manager. * @param callbackManager The callback manager that will encapsulate the callback. * @param callback The login callback that will be called on login completion. */ public void registerCallback( final CallbackManager callbackManager, final FacebookCallback<LoginResult> callback) { if (!(callbackManager instanceof CallbackManagerImpl)) { throw new FacebookException("Unexpected CallbackManager, " + "please use the provided Factory."); } ((CallbackManagerImpl) callbackManager).registerCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult( resultCode, data, callback); } } ); }
public FacebookHelper(@NonNull FacebookListener facebookListener) { mListener = facebookListener; mCallBackManager = CallbackManager.Factory.create(); FacebookCallback<LoginResult> mCallBack = new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { mListener.onFbSignInSuccess(loginResult.getAccessToken().getToken(), loginResult.getAccessToken().getUserId()); } @Override public void onCancel() { mListener.onFbSignInFail("User cancelled operation"); } @Override public void onError(FacebookException e) { mListener.onFbSignInFail(e.getMessage()); } }; LoginManager.getInstance().registerCallback(mCallBackManager, mCallBack); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ButterKnife.bind(this); // [START initialize_auth] // Initialize Firebase Auth mAuth = FirebaseAuth.getInstance(); // [END initialize_auth] //initialize facebook callback callbackManager = CallbackManager.Factory.create(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!FacebookSdk.isInitialized()) { FacebookSdk.sdkInitialize(getApplicationContext()); AppEventsLogger.activateApp(getActivity().getApplication()); } // Initialize Firebase Auth fireBaseAuth = FirebaseAuth.getInstance(); fireBaseAuth.signOut(); facebookCallbackManager = CallbackManager.Factory.create(); registerFirebase(); registerFacebookCallback(); LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email", "public_profile")); }
private void setupFacebookLogin() { mFacebookCallbackManager = CallbackManager.Factory.create(); binding.facebookButton.setReadPermissions("email","public_profile"); // Callback registration binding.facebookButton.registerCallback(mFacebookCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { firebaseAuthWithFacebook(loginResult.getAccessToken()); } @Override public void onCancel() { Toast.makeText(ProfileActivity.this, "Facebook Authentication cancelled.", Toast.LENGTH_SHORT).show(); } @Override public void onError(FacebookException exception) { Toast.makeText(ProfileActivity.this, "Facebook Authentication failed.", Toast.LENGTH_SHORT).show(); Timber.e(exception); } }); }
public LoginFacebook(LoginButton login, Activity context, PreferencesShared pref, final Intent intent) { callbackManager = CallbackManager.Factory.create(); this.context = context; preferencesShared = pref; login.setReadPermissions(Arrays.asList("public_profile", "user_friends")); login.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { //Log.d("facebook", "succes" + loginResult.getAccessToken().getToken() + "id" + loginResult.getAccessToken().getExpires() + "data" + loginResult.getAccessToken().getUserId()); conectedwithFacebook(loginResult.getAccessToken().getToken(),intent); } @Override public void onCancel() { Log.d("intra","facebook"); } @Override public void onError(FacebookException error) { Log.d("facebook", "error" + error.toString()); } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); if(AppController.USER_ID != null && AppController.USER_TOKEN != null) { new CountDownTimer(1000, 100) { public void onTick(long millisUntilFinished) { } public void onFinish() { goActivityMain(); } }.start(); } else { changeToLoginView(); } pref = getSharedPreferences(CONST.PREF_NAME, MODE_PRIVATE); editor = pref.edit(); }
private void initFBSdk() { if (!FacebookSdk.isInitialized()) { FacebookSdk.setApplicationId(ApiObjects.facebook.get("app_id")); FacebookSdk.sdkInitialize(getActivity().getApplicationContext()); } callbackManager = CallbackManager.Factory.create(); profileTracker = new ProfileTracker() { @Override protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) { if (eventHandler != null) { if (currentProfile != null) eventHandler.onFacebookLoggedIn(); } } }; }
@Override public void setCallbackToLoginFacebookButton() { callbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Bundle param = new Bundle(); param.putString("fields", "id, email"); facebookLink(loginResult); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { Logger.logExceptionToFabric(error); } }); }
void initializeFacebookLogin() { // Initialize Facebook Login button mCallbackManager = CallbackManager.Factory.create(); LoginButton loginButton = (LoginButton) findViewById(R.id.button_facebook_login); loginButton.setReadPermissions("email", "public_profile", "user_posts", "user_photos"); loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d(TAG, "facebook:onSuccess:" + loginResult); handleFacebookAccessToken(loginResult.getAccessToken()); } @Override public void onCancel() { Log.d(TAG, "facebook:onCancel"); // ... } @Override public void onError(FacebookException error) { Log.w(TAG, "facebook:onError", error); } }); }
private void init() { UpodsApplication.initAllResources(); vOverlay = findViewById(R.id.vOverlay); //Toolbar toolbar.inflateMenu(R.menu.menu_activity_main); toolbar.setOnMenuItemClickListener(this); toolbar.setTitleTextColor(getResources().getColor(R.color.white)); //Social callbackManager = CallbackManager.Factory.create(); MenuItem searchMenuItem = toolbar.getMenu().findItem(R.id.action_search); SearchView searchView = (SearchView) searchMenuItem.getActionView(); UIHelper.setSearchViewStyle(searchView); UIHelper.changeSearchViewTextColor(searchView, Color.WHITE); slidingMenu = new SlidingMenu(this, toolbar); }
@Override public void onFacebookLoginBntClick(LoginButton loginButton) { mCallbackManager = CallbackManager.Factory.create(); loginButton.setReadPermissions("email", "public_profile"); loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { handleFacebookAccessToken(loginResult.getAccessToken()); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { getView().showSnackBar(error.getMessage()); } }); }
private void configureFacebookLogin(){ FacebookSdk.sdkInitialize(context.getApplicationContext()); ssFacebookCallbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(ssFacebookCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { handleFacebookAccessToken(loginResult.getAccessToken()); } @Override public void onCancel() { // TODO: Handle unsuccessful / cancel } @Override public void onError(FacebookException exception) { loginFailed(exception.getMessage()); } }); }
private void initFaceBookLogin() { callbackManager = CallbackManager.Factory.create(); btnLoginFacebook.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { showDialog(); presenter.requestFacebook(loginResult); LogUtil.e2(loginResult.getAccessToken().toString()); } @Override public void onCancel() { } @Override public void onError(FacebookException error) { } }); }
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getActivity().getApplicationContext()); callbackManager = CallbackManager.Factory.create(); accessTokenTracker = new AccessTokenTracker() { @Override protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) { } }; profileTracker = new ProfileTracker() { @Override protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) { //Toast.makeText(getActivity(), "newProfile", Toast.LENGTH_SHORT).show(); //displayMessage(currentProfile); } }; accessTokenTracker.startTracking(); profileTracker.startTracking(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments()!=null) { isTabBarShown = getArguments().getBoolean(SHOW_TAB_BAR); } BusProvider.getInstance().register(this); home = (Home) getActivity(); user = new User(); // manages the callbacks into the FacebookSdk from an Activity's or Fragment's onActivityResult() method callbackManager = CallbackManager.Factory.create(); gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestProfile() .requestEmail() .build(); if (googleApiClient==null) { googleApiClient = new GoogleApiClient.Builder(home) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); } }
private void setFacebookRule() { callbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { EventBus.getDefault().post(MessageEvent.UPDATE_FACEBOOK_PROFILE); } @Override public void onCancel() { Log.d("Teste", "deu errp"); } @Override public void onError(FacebookException exception) { Log.d("ErrorF", exception.toString()); } } ); Profile profile = Profile.getCurrentProfile(); if (profile != null) { this.sidebar.showHideLogoff(true); } else { this.sidebar.showHideLogoff(false); } }
private void registerFacebookCallback() { final PublishSubject<String> fbAccessToken = this.facebookAccessToken; final BehaviorSubject<FacebookException> fbAuthError = this.facebookAuthorizationError; this.callbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(this.callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(final @NonNull LoginResult result) { fbAccessToken.onNext(result.getAccessToken().getToken()); } @Override public void onCancel() { // continue } @Override public void onError(final @NonNull FacebookException error) { if (error instanceof FacebookAuthorizationException) { fbAuthError.onNext(error); } } }); }
private void shareOnFacebook() { facebookCallbackManager = CallbackManager.Factory.create(); ShareDialog shareDialog = new ShareDialog(this); if (ShareDialog.canShow(ShareLinkContent.class)) { ShareLinkContent linkContent = new ShareLinkContent.Builder() .setShareHashtag(new ShareHashtag.Builder() .setHashtag(getString(R.string.nomorehomelessanimals)).build()) .setQuote(getString(R.string.explore_adoption)) .setContentUrl(Uri.parse(getString(R.string.findmeahome_store_url))) .build(); shareDialog.show(linkContent); } }
public AccountNavigator(FragmentNavigator fragmentNavigator, AptoideAccountManager accountManager, ActivityNavigator activityNavigator, LoginManager facebookLoginManager, CallbackManager callbackManager, GoogleApiClient client, PublishRelay<FacebookLoginResult> facebookLoginSubject, String defaultStore, String defaultTheme, String recoverPasswordUrl) { this.fragmentNavigator = fragmentNavigator; this.accountManager = accountManager; this.activityNavigator = activityNavigator; this.facebookLoginManager = facebookLoginManager; this.callbackManager = callbackManager; this.client = client; this.facebookLoginSubject = facebookLoginSubject; this.defaultStore = defaultStore; this.defaultTheme = defaultTheme; this.recoverPasswordUrl = recoverPasswordUrl; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Timber.d("%s - OnCreateView", this.getClass().getSimpleName()); View view = inflater.inflate(R.layout.dialog_login, container, false); callbackManager = CallbackManager.Factory.create(); loginBaseForm = (LinearLayout) view.findViewById(R.id.login_base_form); loginRegistrationForm = (LinearLayout) view.findViewById(R.id.login_registration_form); loginEmailForm = (LinearLayout) view.findViewById(R.id.login_email_form); loginEmailForgottenForm = (LinearLayout) view.findViewById(R.id.login_email_forgotten_form); prepareLoginFormNavigation(view); prepareInputBoxes(view); prepareActionButtons(view); return view; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.signup_activity); ButterKnife.bind(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mCallbackManager = CallbackManager.Factory.create(); mUserService = OAuth2ServiceFactory.createAnonymousService(UserService.class); mValidator = new Validator(this); mValidator.setValidationListener(this); UniqueEmailRule uniqueEmailRule = new UniqueEmailRule(mName, mUserService); mValidator.put(mEmail, uniqueEmailRule); registerCallback(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCallbackManager = CallbackManager.Factory.create(); setContentView(R.layout.activity_main); initViews(); if (AccessToken.getCurrentAccessToken() == null) { //user not logged in hideViewsAfterLogout(); } else { //user logged in getAvailablePagesAsync(); } }
private CallbackManager setupFacebookSignIn() { CallbackManager callbackManager = CallbackManager.Factory.create(); fbSignInButton.setReadPermissions("email", "public_profile"); fbSignInButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d("MAPP", "facebook:onSuccess: " + loginResult); handleFacebookAccessToken(loginResult.getAccessToken()); } @Override public void onCancel() { Log.d("MAPP", "facebook:onCancel"); // ... } @Override public void onError(FacebookException error) { Log.d("MAPP", "facebook:onError", error); // ... } }); return callbackManager; }
@Override public void initFbLoginButton() { mCallbackManager = CallbackManager.Factory.create(); mLoginFbButton.setReadPermissions("email", "public_profile"); mLoginFbButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Timber.d("facebook:onSuccess:" + loginResult); mPresenter.handleFacebookAccessToken(loginResult.getAccessToken()); } @Override public void onCancel() { Timber.d("facebook:onCancel"); } @Override public void onError(FacebookException error) { Timber.d("facebook:onError", error); } }); }
private void setupFacebookLogin() { //TODO: Check if facebook login is actvated in the server String appId = FacebookSdk.getApplicationId(); Timber.d("appId: " + appId); if (appId != null) { mCallbackManager = CallbackManager.Factory.create(); mFacebookButton.setReadPermissions(PERMISSIONS); mFacebookButton.registerCallback(mCallbackManager, mFacebookCallback); mAccessTokenTracker = new AccessTokenTracker() { @Override protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) { if (currentAccessToken != null) { mRxRocketMethods.loginWithFacebook(currentAccessToken.getToken(), currentAccessToken.getExpires().getTime() - new Date().getTime()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(mLoginSubscriber); } } }; } else { mFacebookButton.setVisibility(View.GONE); } }
private void initFB() { FacebookSdk.sdkInitialize(mContext); callbackManager = CallbackManager.Factory.create(); mShareDialog = new ShareDialog(mContext); // this part is optional mShareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() { @Override public void onSuccess(Sharer.Result result) { } @Override public void onCancel() { } @Override public void onError(FacebookException error) { } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getActivity().getApplicationContext()); mCallbackManager = CallbackManager.Factory.create(); profileTracker = new ProfileTracker() { @Override protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) { final Profile profile = currentProfile; if (profile != null) { final Thread thread = new Thread() { public void run() { createUserFromFacebook(profile); openListsOverview(); } }; thread.start(); } } }; printKeyHash(getActivity()); }
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); callbackManager = CallbackManager.Factory.create(); LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Logger.d("onSuccess"); onFaceBookLoginSuccess(loginResult); } @Override public void onCancel() { Logger.d("onCancel"); onFaceBookLoginCancel(); } @Override public void onError(FacebookException error) { Logger.d("onError"); onFaceBookLoginError(error); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(this.getApplicationContext()); callbackManager = CallbackManager.Factory.create(); shareDialog = new ShareDialog(this); shareDialog.registerCallback( callbackManager, shareCallback); // Can we present the share dialog for regular links? canPresentShareDialog = ShareDialog.canShow( ShareLinkContent.class); // Can we present the share dialog for photos? canPresentShareDialogWithPhotos = ShareDialog.canShow( SharePhotoContent.class); }
private void registerFacebookCallback(){ callbackManager = CallbackManager.Factory.create(); // Callback registration facebookButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { signInViaFacebook(loginResult.getAccessToken()); } @Override public void onCancel() { // App code } @Override public void onError(FacebookException exception) { // App code } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); setContentView(R.layout.select_domain); TextView server = (TextView) findViewById(R.id.textView_server_url); url = getIntent().getStringExtra("server"); server.setText(url); callbackManager = CallbackManager.Factory.create(); findViewById(R.id.button_domain_google).setOnClickListener(this); ((SignInButton) findViewById(R.id.button_domain_google)).setSize(SignInButton.SIZE_WIDE); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)) .build(); }
public void setUpFacebookLoginButton(Fragment hostFragment, CallbackManager callbackManager) { btnLoginWithFacebook.setReadPermissions(FacebookUtils.FB_PERMISSION_LIST); btnLoginWithFacebook.setFragment(hostFragment); btnLoginWithFacebook.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { processFacebookLoginResult(loginResult); } @Override public void onCancel() { } @Override public void onError(FacebookException exception) { } }); }