2

Am trying to build a dynamic url, using Firebase dynamic links but i get a exception.

private void sendNativeInvites(){ String email = UserUtils.getCurrentUser(this).getEmail(); String link = "https://play.google.com/store/apps/details?id=com.mindedges.beephourly?invitedby=" + email; FirebaseDynamicLinks.getInstance().createDynamicLink() .setLink(Uri.parse(link)) .setDomainUriPrefix("https://c6yge.app.goo.gl") .setAndroidParameters( new DynamicLink.AndroidParameters.Builder("com.example.android") .setMinimumVersion(125) .build()) .buildShortDynamicLink() .addOnSuccessListener(new OnSuccessListener<ShortDynamicLink>() { @Override public void onSuccess(ShortDynamicLink shortDynamicLink) { Log.e(TAG, "Successfully built build dynamic link"); Uri invitationUrl = shortDynamicLink.getShortLink(); doSendInvite(invitationUrl); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.e(TAG, "failed to build dynamic link", e); } }); } failed to build dynamic link com.google.android.gms.common.api.ApiException: 400: Request contains an invalid argument. at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(Unknown Source:12) at com.google.firebase.dynamiclinks.internal.zzi.zza(Unknown Source:4) at com.google.firebase.dynamiclinks.internal.zzn.dispatchTransaction(Unknown Source:10) at com.google.android.gms.internal.firebase_dynamic_links.zzb.onTransact(Unknown Source:12) at android.os.Binder.execTransact(Binder.java:697) 

Am not getting what wrong param am passing. I own the domain "https://c6yge.app.goo.gl" as per firebase console.

1
  • What version of dynamic links are using? Commented Jan 26, 2019 at 10:58

2 Answers 2

2
+125

I can see a minor error in your code. That have been caused by mistakenly copying some codes from the documentation without editing them.

Here is the lines that has caused your problems:

.setAndroidParameters( new DynamicLink.AndroidParameters.Builder("com.example.android") .setMinimumVersion(125) .build()) 

Instead of "com.example.android" you were supposed to replace that with your own package name which I think it is "com.mindedges.beephourly". So in the documentation they wrote that just like an example but you were expected to change it to your own package name.

Also in the same code above instead of (125) you are supposed to change that to your own version code. In android there are version codes for Apps and when you update an app you will have to change version code (integer) and version name (String) so you may have a number of App versions but in there you were supposed to pass the minimum the lowest version code that can open that dynamic link. I am forced not to believe you have ever made 125 updates in your app in Playstore. So if you want all your apps old and new version to open you could replace (125) with (1). You can find the current version code in your build.gradle files. In your project.

Let me know if you still face some difficulties.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer. I will try it and update my findings
I reid to replace the use correct name and set minversion to one, still getting same issue. Also when i try to manually create a link from firebase console i get error "here was an unknown error while processing the request. Try again. "
0

Can you double check if you got the correct domain? Based on your code, it looks like everything works fine. However, the issue seems to be with your domain.

Checking the link as https://c6yge.app.goo.gl/?link=https://google.com, you should be redirected to https://google.com but it didn't. Instead, it just shows Dynamic Link not Found. So I'm thinking it's not properly configured.

Here's a sample working link: https://ratbu.page.link/?link=https://google.com.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.