6

After getting app invite, invitee clicks on link. Based on app already installed or not, he will be directed to app store and finally come to Actiity which handles AppInite link.

My deep link look like this: http://example.com/app-invite/

Where user_id is id of registed user (in my backend server). I am able to get the correct id of the user.

This is the code for handling deep link.

private void processReferralIntent(Intent intent) {
    String invitationId = AppInviteReferral.getInvitationId(intent);
    String deepLink = AppInviteReferral.getDeepLink(intent);
    String userId = deepLink.substring(deepLink.lastIndexOf("/") + 1);
    Utility.displayToast("userid " + userId);


    // Handle the deep link. For example, open the linked
    // content, or apply promotional credit to the user's
    // account.

    Log.d(TAG, "Found Referral: " + invitationId + ":" + deepLink);
    ((TextView) findViewById(R.id.deep_link_text))
            .setText(getString(R.string.deep_link_fmt, deepLink));
    ((TextView) findViewById(R.id.invitation_id_text))
            .setText(getString(R.string.invitation_id_fmt, invitationId));
}

Now if this is the first time invitee is installing the app, on clicking on app invite link, i want to give some promotion credits to both invitee and inviter.

How can i know this is the first time? Beacuse even app is installed alredy processReferralIntent() will be called.

Devesh Agrawal
  • 8,982
  • 16
  • 82
  • 131

0 Answers0