Facebook API integration:
link to refer : https://developers.facebook.com/docs/facebook-login/android
1.Create App in facebook developer console
visit https://developers.facebook.com to create app
click add new app -> choose platform Andorid -enter display name & choose category
add packagename in Google Play Package Name box then add Class Name then add key hash
1.Programatically get hashKey:
call getFacebookHashKey method using FacebookManager class in activity onCreate then this method will print hashkey in logcate
2.To generate a hash of your release key, run the following command on Windows substituting your release key alias and the path to your keystore.
keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
after creation get App ID from developer account and replace the "facebook_app_id" key in string.xml
First add facebook sdk to app gradle by adding below line:
then add FacebookManager class file from facebook package (From provided project) then add "FacebookSdk.sdkInitialize(this.getApplicationContext());" this line in your Application class's onCreate() method
FacebookManager.getInstance().loginWithFacebook(MainActivity.this, mCallbackManager, this, FLAG_FACEBOOK_LOGIN);
FacebookManager.getInstance().logoutFacebook();
FacebookManager.getInstance().facebookImageShare(MainActivity.this, mShareDialog, "Facebook Image Share", "Hello to all!", imageUrl);
String profileImageUrl = FacebookManager.getInstance().getProfileImage();
int SIZE = 500; String profileImageUrl = FacebookManager.getInstance().getProfileImage(SIZE);
FacebookManager.getInstance().getFacebookProfile();
/** facebook initially will allow to access basic info about user such as name,emailId,FirstName,LastName,id,gender
In order to get Date of Birth & other things we have to submit an app for review through developer console .
For that we need following things: -Privacy Policy URL -App icons
**/