简体   繁体   中英

Android - Google App Invites - Getting referral information

Im designing an app that uses the Google App invites system. What i would like to do is get some way of getting the email of the person who sent the invite.

ie User1 sends invite > User2 installs app > Activity says "You where invited by User1@gmail.com"

So far i have implemented the Google Tutorial which is working fine and allowing people to invite others to install the app.

I assume the changes have to be made to this but im not sure

@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);
}

we can get the GMail id like this :

try {
        AccountManager accountManager = AccountManager.get(context);
        Account account = getAccount(accountManager);
        if (account == null) {
            return "";
        } else {
            return account.name;
        }
    } catch (Exception ex) {
        return "";
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM