1

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.

i.e 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);
}
user237462
  • 387
  • 1
  • 5
  • 24

1 Answers1

1

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 "";
    }
Amit Rautela
  • 54
  • 1
  • 5