谷歌加登录
问题描述:
我已经成功地集成谷歌的API来登录使用G +帐户,谷歌加登录
我能够得到用户的电子邮件地址和姓名,我所需要的所有信息,
但我期待的方式,我如何将这些信息发送给我的开发人员电子邮件ID,以便我可以通过gmail与用户沟通。
这里是我使用来获取所有的代码,
private void getProfileInformation() {
try {
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
.getCurrentPerson(mGoogleApiClient);
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
sharedPreferences=this.getPreferences(1);
edt = sharedPreferences.edit();
edt.putString("personName", personName);
edt.putString("personPhotoUrl", personPhotoUrl);
edt.putString("personGooglePlusProfile", personGooglePlusProfile);
edt.putString("email",email);
edt.apply();
Log.e(TAG, "Name: " + personName + ", plusProfile: "
+ personGooglePlusProfile + ", email: " + email
+ ", Image: " + personPhotoUrl);
// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
personPhotoUrl = personPhotoUrl.substring(0,
personPhotoUrl.length() - 2)
+ PROFILE_PIC_SIZE;
new LoadProfileImage(imgProfilePic).execute(personPhotoUrl);
} else {
Toast.makeText(getApplicationContext(),
"Person information is null", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
} }
答
有两种方法做到这一点:
要么你传递一个意图,将用户带到电子邮件应用程序,用户有权发送或不发送邮件。 (这不会起作用,因为用户可能不想分享他们的信息)
或者您创建一个API并将用户数据发送到您的服务器。
你想发送用户的电子邮件ID到您的电子邮件地址? –
是的,我想要.. –