9.28facebook获取用户email,fragment

参考:
https://www.lassiemarlowe.com/tutorials/create-a-facebook-social-login-using-php-and-the-facebook-sdk/
https://www.sammyk.me/optimizing-request-queries-to-the-facebook-graph-api

http://stackoverflow.com/questions/29295987/android-facebook-4-0-sdk-how-to-get-email-date-of-birth-and-gender-of-user

用这个接口获取:
http://graph.facebook.com/austintodo
代码:

取得AccessToken后
 // App code
                GraphRequest request = GraphRequest.newMeRequest(
                        loginResult.getAccessToken(),
                        new GraphRequest.GraphJSONObjectCallback() {
                            @Override
                            public void onCompleted(
                                    JSONObject object,
                                    GraphResponse response) {
                                // Application code
                                Log.v("LoginActivity", response.toString());
                            }
                        });
                Bundle parameters = new Bundle();
                parameters.putString("fields", "id,name,email,gender, birthday");
                request.setParameters(parameters);
                request.executeAsync();

//fragment的startactviity的bug
http://blog.csdn.net/primer_programer/article/details/27184877
http://www.tuicool.com/articles/2eM32a
主要原因:
fragment.startactivityforresult()

fragment.getactivity().startactivityforresult()
是不同的,前者会回调
fragment.onactivityresult()
而后者不会,开发的时候要注意了

你可能感兴趣的:(9.28facebook获取用户email,fragment)