如何在Firebase中获取被邀请者的电子邮件地址?

时间:2017-01-29 11:27:46

标签: java android

我正在尝试获取用户从我的应用中邀请的人的电子邮件地址

这是我的代码:

private void onInviteClicked() {
    Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
            .setMessage(getString(R.string.invitation_message))
            .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
            .setCustomImage(Uri.parse("http://jennstrends.com/wp-content/uploads/2013/10/bad-profile-pic-2.jpeg"))
            .setCallToActionText(getString(R.string.invitation_cta)).setCallToActionText("email").build();

    startActivityForResult(intent, REQUEST_INVITE);
}

int REQUEST_INVITE = 10101;

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode);

    if (requestCode == REQUEST_INVITE) {
        if (resultCode == RESULT_OK) {
            // Get the invitation IDs of all sent messages
            final String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data);
            final List<String> members = new ArrayList();

            members.add(GoogleAuthHelper.getInstance().getUser().getProjectId());
            for (String id : ids) {
                members.add(id);
            }

            ApiClient.getInstance(getBaseContext()).addMembers(members, new OnPostListener<String>() {
                @Override
                public void onError(ANError error) {
                    Log.e("Server", "Members: " + error.getErrorCode());
                }
                @Override
                public void onResponse(String val) {
                    Log.d("Server", "Response from Member: " + val.toString());
                }
            });
        } else {
            // Sending failed or it was canceled, show failure message to
            // the user
            // ...
            Log.d("Server", "Invitation Failed code: " + resultCode);
        }
    }
}

现在,我如何获取用户邀请的人员列表的电子邮件地址。 AppInviteInvitation.getInvitationIds()不是电子邮件ID。有人帮帮我!请!

0 个答案:

没有答案