Integrated Facebook login in my Android app.
I have two requirements in my application
1) Obtaining a registered user email id
2) Send the feed to the Facebook user on the wall about installing the application and the link
I can get emails using read permissions
private void fbLogin() { LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList( "public_profile", "user_birthday", "email" ) ); LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { SharedPreferences.Editor editor = facebookPreferences.edit(); AccessToken accessToken = loginResult.getAccessToken(); if (accessToken != null) { fbProfile(); } } }
I can publish a feed using publish permissions
private void fbLogin() { LoginManager.getInstance().logInWithPublishPermissions(this, Arrays.asList( "publish_actions" ) ); LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { SharedPreferences.Editor editor = facebookPreferences.edit(); AccessToken accessToken = loginResult.getAccessToken(); if (accessToken != null) { fbPostAFeed(); } } }
No re-entry to change the resolution.
But my requirement is to get an email id and submit the feed to Facebook. I know that login can be associated with read permissions or publishing permissions. I searched about this, I found that one thing is the session, but, Facebook doc says: the session class is no longer available in the latest version of the SDK Then how can I do it. This is their way of doing it. Thanks in advance.
android facebook
Andan hm
source share