1

我正在设计一个使用 Google App 邀请系统的应用程序。我想做的是获得某种方式来获取发送邀请的人的电子邮件。

即用户 1 发送邀请 > 用户 2 安装应用程序 > 活动说“你是由 User1@gmail.com 邀请的”

到目前为止,我已经实施了Google 教程,该教程运行良好,并允许人们邀请其他人安装该应用程序。

我认为必须对此进行更改,但我不确定

@Override
public void onReceive(Context context, Intent intent) {
    // Create deep link intent with correct action and add play store referral information
    Intent deepLinkIntent = AppInviteReferral.addPlayStoreReferrerToIntent(intent,
            new Intent(context.getString(R.string.action_deep_link)));

    // Let any listeners know about the change
    LocalBroadcastManager.getInstance(context).sendBroadcast(deepLinkIntent);
}
4

1 回答 1

1

我们可以像这样获取 GMail id:

try {
        AccountManager accountManager = AccountManager.get(context);
        Account account = getAccount(accountManager);
        if (account == null) {
            return "";
        } else {
            return account.name;
        }
    } catch (Exception ex) {
        return "";
    }
于 2015-11-04T11:38:20.393 回答