5

I'm using Firebase dynamic links with link shortener and I want to define fallback link for clients beside Android and iOS. Manually constructed dynamic links have parameter ofl that does exactly what I need The link to open on platforms beside Android and iOS. However it seems that this parameter is missing in shortener documentation. Although ofl is mention in the description of link parameter in shortener docs When users open a Dynamic Link on a desktop web browser, they will load this URL (unless the ofl parameter is specified).

Is it possible to somehow add a fallback url for clients beside Android and iOS (e.g. web) to redirect users there instead of link parameter

2 Answers 2

10

By using REST API

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

{
  "dynamicLinkInfo": {
    "domainUriPrefix": "https://example.page.link",
    "link": "https://www.example.com/",
    "androidInfo": {
      "androidPackageName": "com.example.android"
    },
    "iosInfo": {
      "iosBundleId": "com.example.ios"
    },
    "desktopInfo": {
      "desktopFallbackLink": "https://www.other-example.com/"
    },
  }
}
Sign up to request clarification or add additional context in comments.

4 Comments

@RyanRomanchuk By reading the python-firebase lib source code
Thanks, i swear they used to have ofl in the console as well, bet it looks like it has been removed. Can confirm key/value for desktopInfo is working as expected for this REST call though
OMG you just saved my life, thank you so much. One extra thing I had to do is whitelist the URL I want to use as fallback in Firebase Console, after that everything finally worked.
Thanks for your answer! Works for me. It is really strange that Google hasn't included 'desktopInfo' param in their official documentation.
3

The simplest way to set fallback url in short dynamic link is to create long link manually and then use sdk to convert it to short one:

val longLink = "$domain/?link=$deepLink&apn=$androidPackage&ibi=$iosPackage&isi=$iosAppStoreId&ofl=$desktopFallbackLink"

FirebaseDynamicLinks
                .getInstance()
                .createDynamicLink()
                .setLongLink(Uri.parse(link))
                .buildShortDynamicLink()
                .addOnSuccessListener {
                    val shortLink = it.shortLink
                    //do something with the link here
                }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.