1
votes

I recently manually created a dynamic link from Firebase Console. When clicking short\long links from Firebase console, from an Android device, the links work just fine.

I'm facing 2 problems. When I'm creating a dynamic link by REST API here:

  1. Short link not saved in console.
  2. Android app not opening link no matter how I configure my URL scheme in manifest.

My steps to create dynamic links by REST:

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=MY_API_KEY
Content-Type: application/json

{
   "longDynamicLink": "https://r8prz.app.goo.gl/?link=http://www.socialTanya.co.il/group/groupId&apn=com.ssa.socialtanya&ibi=com.ssa.socialtanya"
}

Response:

{
"shortLink": "https://r8prz.app.goo.gl/J4qcykV9ol7X3Rh33",
"previewLink": "https://r8prz.app.goo.gl/?link=http://www.socialTanya.co.il/group/itzhar&apn=com.ssa.socialtanya&ibi=com.ssa.socialtanya&d=1"
}

When clicking on https://r8prz.app.goo.gl/J4qcykV9ol7X3Rh33, I see loading dialog for a few seconds and then the browser opens with "page not found" error.

manifest.xml:

<intent-filter>
       <action android:name="android.intent.action.VIEW"/>

       <category android:name="android.intent.category.DEFAULT"/>
       <category android:name="android.intent.category.BROWSABLE"/>

       <data
           android:host="www.socialTanya.co.il"
           android:pathPrefix="/group/"
           android:scheme="http"/>

       <data
           android:host="www.socialTanya.co.il"
           android:pathPrefix="/group/"
           android:scheme="https"/>

</intent-filter>

Working links from console:

  1. https://r8prz.app.goo.gl/qL6j
  2. https://r8prz.app.goo.gl/?link=http://www.socialTanya.co.il/group&apn=com.ssa.socialtanya&sd=%D7%94%D7%A6%D7%98%D7%A8%D7%A3+%D7%9C%D7%9C%D7%99%D7%9E%D7%95%D7%93+%D7%AA%D7%A0%D7%99%D7%90+%D7%9E%D7%A9%D7%95%D7%AA%D7%A3
1

1 Answers

2
votes

OK, after a while, I find the problem and it was totally JAVA issue:

when I send dynamic link from android, I chain some text with String.format():

String shareLink = String.format("%s - %s\n%s","to join group","GROUP_NAME","https://r8prz.app.goo.gl/J4qcykV9ol7X3Rh33");

I got broken link because upper dash character:

enter image description here

enter image description here

and when I click link from mobile I notice the base url changed to:

https://r8prz.app-alt.goo.gl

app-alt enter image description here my geuss is when the dynamic link id is not exist, base url become app-alt.

so my solution was, to chain the share link with custom string 'Handmade':

String shareLink = "to join group" + "GROUP_NAME" + "https://r8prz.app.goo.gl/J4qcykV9ol7X3Rh33";