获取Facebook电子邮件parse.com [英] Get facebook email parse.com

查看:138
本文介绍了获取Facebook电子邮件parse.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试保存一个Facebook用户的电子邮件,当他们登录到我的应用程序。唯一的例子解析是这样的,但即使我要求正确的Facebook许可,它也不会保存电子邮件。

I am trying to save a facebook user's email when they log in to my app. The only example parse provides is this, but It does not save emails even when I ask for the correct facebook permission.

private void onLoginButtonClicked() {
    if (loginProgressDialog != null) {
        loginProgressDialog.dismiss();
        loginProgressDialog = null;
    }

    loginProgressDialog = ProgressDialog.show(LoginActivity.this, "", "Logging in...", true);
    List<String> permissions = Arrays.asList("public_profile", "user_about_me", "user_relationships", "user_birthday", "user_location", "email");
    ParseFacebookUtils.logIn(permissions, this, new LogInCallback() {
        @Override
        public void done(ParseUser user, ParseException err) {
            if (loginProgressDialog != null) {
                loginProgressDialog.dismiss();
                loginProgressDialog = null;
            }

            if (user == null) {
                Log.d("The Bar App", "Uh oh. The user cancelled the Facebook login.");
            } else if (user.isNew()) {
                Log.d("The Bar App", "User signed up and logged in through Facebook!");
                showNextActivity();
            } else {
                Log.d("The Bar App", "User logged in through Facebook!");
                showNextActivity();
            }
        }
    });
}

有没有一个Facebook对象或一些返回的JSON,我可以抓住电子邮件来自?

Is there a facebook object or some JSON that gets returned that I could grab emails from?

推荐答案

您已要求获取权限,现在您必须要求数据。

You've asked for the permissions, now you have to actually ask for the data.

您需要为/ me进行图形查询。

You need to do a graph query for /me.

https://developers.facebook.com/docs/android/graph

有一种方法称为 executeMeRequestAsync(),您需要尝试查看 getProperty(email)以查看电子邮件如果他们已经分享了这些信息,请确保处理为空。

There's a method called executeMeRequestAsync(), you'll need to try looking at getProperty("email") for the email to see if they've shared that information, make sure you handle when this is empty.

这篇关于获取Facebook电子邮件parse.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆