Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase dynamic link opens playstore randomly, but app is already installed

Sometimes, dynamic link works well. But some times, it just open google play store and this is the problem.

Especially, it shows google play store more frequently when then app is not running.

Any suggestion will be appreciated.


Edit:

I tried following sequence and failed:

  • Click link send by Whats app
  • Web browser opens
  • Google play store app opens <= Just shows my app, with "Open" button

But by this sequence, it was successful.

  • One web browser was already opened
  • Click link on Whats app
  • Everything is fine, deeplink params delievered.

  • I followed this official example,
    https://github.com/firebase/quickstart-android/tree/master/dynamiclinks/app


  • And this is my dynamic link
    https://stanleyko.page.link/?amv=0&apn=com.stanleyko.fdl&link=https%3A%2F%2Fkotlin.example.com%2Fdeeplinks%3Fearn%3Dq1w2e3r4


  • This is my intent-filter.

    <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="truebalance.io/products"
            android:scheme="https" />
    </intent-filter>
    

  • And this is my google play store url.
    https://play.google.com/store/apps/details?id=com.stanleyko.fdl

like image 541
Stanley Ko Avatar asked Nov 27 '25 11:11

Stanley Ko


1 Answers

The key point was adding application id. With this option, the link will launch app directly and will not open google play store if app was already installed.

Firebase.dynamicLinks.shortLinkAsync {
    domainUriPrefix = MY_PREFIX
    androidParameters(BuildConfig.APPLICATION_ID) {
        minimumVersion = MY_MIN_VERSION
    }
    link = myDeepLink // My deep link
}.addOnSuccessListener { result ->
    val shortLink = result.shortLink
    // Use shortLink
}.addOnFailureListener {
    // Do something
}

I have found the answer from below. Details:
https://stackoverflow.com/a/51224484/850347

like image 144
Stanley Ko Avatar answered Nov 29 '25 01:11

Stanley Ko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!