0

Let's assume First user send invitation to second user. User send some global link and second user receive it. In my case user received dynamic link instead of global link in Android device.

I would like to share current uri https://aewp.com/share

private void shareVocabulary() {
    Intent intent = new AppInviteInvitation.IntentBuilder("Text")
            .setMessage("Message")
            .setDeepLink(createDynamicLink().getUri())
            .setCustomImage(Uri.parse("https://lh3.googleusercontent.com/info.jpg"))
            .setCallToActionText(getString(R.string.install))
            .build();
    startActivityForResult(intent, SHARE_RESULT_CODE);
}

public DynamicLink createDynamicLink(){

        String domain = getString(R.string.domain) + ".app.goo.gl";

        return FirebaseDynamicLinks.getInstance().createDynamicLink().
                setLink(Uri.parse("https://aewp.com/share")).
                setDynamicLinkDomain(domain).
                setAndroidParameters(new DynamicLink.AndroidParameters.Builder(getPackageName()).
                        setFallbackUrl(Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName())).
                        build()
                ).
                buildDynamicLink();
    }

DeepLinkActivity.class

In following code each time returned dynamic link, instead of global link

 FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent())
                .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                    @Override
                    public void onSuccess(PendingDynamicLinkData data) {
                        if (data == null) {
                            Logger.logInfo(getClass(), "getInvitation: no data");
                            return;
                        }

                        // Get the deep link
                        Uri link = data.getLink();
                    }
                })
                .addOnFailureListener(this, new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Logger.logError(getClass(), "getDynamicLink:onFailure", e);
                    }
                });

As far as I undersand I should recive this link "https://aewp.com/share" instead of short or large dynamic link

How can I fix that ?

Vahe Gharibyan
  • 5,277
  • 4
  • 36
  • 47

1 Answers1

0

There are a little bit difference between Intent types To Firebase AppInviteInvitation we does not use deep link, instead of it we should pass dynamic link.

    Intent intent = new AppInviteInvitation.IntentBuilder("Send")
            .setMessage("Message")
            .setDeepLink(R.string.global_link).build())
            .setCustomImage(Uri.parse("https://lh3.googleusercontent.com/9.jpg"))
            .setCallToActionText("Install"))
            .build();
    startActivityForResult(intent, SHARE_RESULT_CODE);

While send data using Intent.ACTION_SEND, We need to use a dynamic link for different platforms

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT,"Text here " + createDynamicLink().getUri().toString());
    intent.setType("text/plain");
    startActivity(Intent.createChooser(intent, "choose one"));
Vahe Gharibyan
  • 5,277
  • 4
  • 36
  • 47