如何在firebase邀请中的接收端访问其他引用参数

时间:2016-06-24 08:48:58

标签: firebase firebase-dynamic-links

这是派遣方。

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发送地图,如何在接收端访问这些值?
  3. 请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

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

找到这个额外信息:https://github.com/firebase/quickstart-android/issues/133 &#34; @droidwala与团队交谈后,看起来不再需要这种方法,很快就会被删除&#34;

发件人

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();