Android | Firebase invite result code is OK but invite NOT sent

◇◆丶佛笑我妖孽 提交于 2019-12-13 07:24:19

问题


I am implementing firebase dynamic links in an Android application (an index of recipes app), at first it was basic and worked without any issue:

viewHolder.mShareBtn.setOnClickListener(view -> {    
            Intent intent = new AppInviteInvitation.IntentBuilder(mContext.getResources().getString(R.string.invitation_title))
                    .setMessage(mContext.getResources().getString(R.string.invitation_message))
                    .build();

            ((AppCompatActivity) mContext).startActivityForResult(intent, 4);
        });

However I tried to make them smarter by adding a deep link to the recipe:

viewHolder.mShareBtn.setOnClickListener(view -> {
            Uri deepLink = Uri.parse(mContext.getResources().getString(R.string.invitation_uri));
            Uri deepLinkPlus = Uri.withAppendedPath(deepLink, recipeKey);

            Intent intent = new AppInviteInvitation.IntentBuilder(mContext.getResources().getString(R.string.invitation_title))
                    .setMessage(mContext.getResources().getString(R.string.invitation_message))
                    .setDeepLink(deepLinkPlus)
                    .build();

            ((AppCompatActivity) mContext).startActivityForResult(intent, 4);
        });

After the code change, the result code is still ok and I get the toast as sent but it is not received by the intended recipient nor does it appear in the message app. I tried to revert to my first implementation, it doesn't work anymore.

This seems to be already documented but there are no answers Duplicate 1 and Duplicate 2

All help welcomed, Thanks for taking a look!

Here's the receiving activity:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(AppInvite.API)
            .enableAutoManage(this, this)
            .build();
    AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false)
            .setResultCallback(
                    result -> {
                        if (result.getStatus().isSuccess()) {
                            //Get intent information
                            Intent intent = result.getInvitationIntent();
                            Uri deepLink = Uri.parse(AppInviteReferral.getDeepLink(intent));
                            //
                            Intent mIntent = new Intent(getApplicationContext(), RecipeDetailActivity.class);
                            mIntent.putExtra("recipe_key", deepLink.getLastPathSegment());
                            startActivity(mIntent);
                        }
                    }
            );

EDIT - After invalidating caches and restarting the project + clean and rebuild, I can get the email invites to work, SMS still not working. Is it failing silently? The result code is -1


回答1:


The solution was to add the SHA256 on top of SHA1.



来源:https://stackoverflow.com/questions/42516592/android-firebase-invite-result-code-is-ok-but-invite-not-sent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!