如何通过点击应用邀请链接来了解被邀请者是否第一次安装应用

Dev*_*wal 6 firebase firebase-invites

获得应用邀请后,被邀请者点击链接.根据已经安装的应用程序,他将被引导到app store,最后来到处理AppInite链接的Actiity.

我的深层链接看起来像这样:http: //example.com/app-invite/

其中user_id是注册用户的id(在我的后端服务器中).我能够获得用户的正确ID.

这是处理深层链接的代码.

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));
}
Run Code Online (Sandbox Code Playgroud)

现在,如果这是被邀请者第一次安装应用程序,点击应用邀请链接,我想给被邀请者和邀请者一些促销信用.

我怎么知道这是第一次?甚至应用程序安装alredy processReferralIntent()将被调用.