Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
- @Override
- public void onSuccess(LoginResult loginResult) {
- GraphRequest request = GraphRequest.newMeRequest(
- loginResult.getAccessToken(),
- new GraphRequest.GraphJSONObjectCallback() {
- @Override
- public void onCompleted(
- JSONObject object,
- GraphResponse response) {
- // Application code
- try {
- JSONObject jsonObject = new JSONObject(response.toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }catch (NullPointerException e){
- }
- }
- });
- Bundle parameters = new Bundle();
- parameters.putString("fields", "id,name,email,gender, birthday");
- request.setParameters(parameters);
- request.executeAsync();
- }
- @Override
- public void onCancel() {
- Log.e("facebook","canceled");
- }
- @Override
- public void onError(FacebookException e) {
- Log.e("facebook error",e.getMessage().toString());
- }
- });
- {Response: responseCode: 200, graphObject: {"id":"931177080295510","birthday":"06/24/1991","gender":"male","email":"smemamian@yahoo.com","name":"Masoud Emamian"}, error: null}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement