Ender
Ender

Reputation: 127

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

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

Upvotes: 0

Views: 651

Answers (1)

Ender
Ender

Reputation: 127

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

Upvotes: 3

Related Questions