4

这是发送方。

private void onInviteClicked() {

    Map<String, String> referralParams = new HashMap<String, String>();
    referralParams.put("Name", "Devesh Agrawal");
    referralParams.put("id", "1000");

    Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
            .setMessage(getString(R.string.invitation_message))
            .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
            .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))
            .setCallToActionText(getString(R.string.invitation_cta))
            .setAdditionalReferralParameters(referralParams)
            .build();
    startActivityForResult(intent, REQUEST_INVITE);
}

这是接收端:

private void processReferralIntent(Intent intent) {
    // Extract referral information from the intent
    String invitationId = AppInviteReferral.getInvitationId(intent);
    String deepLink = AppInviteReferral.getDeepLink(intent);

    // Display referral information
    // [START_EXCLUDE]
    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));
    // [END_EXCLUDE]
}

我有以下查询:

  1. 接收端的invitationId有什么用?这可以用于任何目的吗?
  2. 我正在为 AdditionalReferralParameters 发送地图,如何在接收端访问这些值?

请帮助我。

4

1 回答 1

0

我很快就放弃了这个想法,并假设推荐参数有其他用途:-(但我使用深度链接获取了我的数据:

发现了这个额外的信息:https ://github.com/firebase/quickstart-android/issues/133 “@droidwala 在与团队交谈后,看起来这个方法不再需要并且很快就会被删除”

在发件人中

Uri deepLink = Uri.parse(getString(R.string.invitation_uri));
Uri deepLinkPlus = Uri.withAppendedPath(deepLink, family.getUid());
Intent intent = new AppInviteInvitation.IntentBuilder(...)
                         .setDeepLink(deepLinkPlus);

在 AppInvite.AppInviteApi.getInvitation 回调中

Uri deepLink = Uri.parse(AppInviteReferral.getDeepLink(intent));
String uid = deepLink.getLastPathSegment();
于 2016-12-02T04:21:39.607 回答