How to do Facebook Login with Custom Button Android
In my previous Facebook Post(http://androidammy.blogspot.in/2015/07/facebooklogin1.html). I write how to use Facebook default button to login with Facebook.
In this blog I am writing about how we can use facebook login functionality from android widget like Button/TextView/ImageView. All the steps are same as last facebook login post. This blog describe that how to create instance of CallBackManager and LoginManager and how to call Login from click listener.
1. Create Instance of LoginManager and CallbackManager.
All Done.
Happy Coding.
In this blog I am writing about how we can use facebook login functionality from android widget like Button/TextView/ImageView. All the steps are same as last facebook login post. This blog describe that how to create instance of CallBackManager and LoginManager and how to call Login from click listener.
1. Create Instance of LoginManager and CallbackManager.
com.facebook.login.LoginManager fbLoginManager; fbLoginManager = com.facebook.login.LoginManager.getInstance(); CallbackManager callbackManager = CallbackManager.Factory.create(); mFbLoginManager.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { // here write code When Login successfully } @Override public void onCancel() { } @Override public void onError(FacebookException e) { // here write code when get error } });
2. Call loginWithReadPermission method of LoginManager class from clickListener of android widget, Like
buttonFbLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFbLoginManager.logInWithReadPermissions(LoginActivity.this, Arrays.asList("email", "public_profile", "user_birthday")); } });
All Done.
Happy Coding.
Facebook has no operating system or browser to guarantee its presence on mobile phones The company depends on apps and the mobile Web. www.facebook.com login
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGG it works nice !
ReplyDeleteWorked great! Good job bro
ReplyDeleteThe blog has been written very well the writer is well skilled and also experienced, for any information about Gmail the user should visit:
ReplyDeletevisit site
The blog has been written very well the writer is well skilled and also experienced, for any information about Gmail the user should visit:
ReplyDeleteFacebook bellen
Hey friend, it is very well written article, thank you for the valuable and useful information you provide in this post. Keep up the good work! Happy ig captions
ReplyDeleteThis is useful information. Thank you for your post. Really helpful.
ReplyDeleteFacebook bellen