Firebase Deep-link opening play store even when the app is installed

前端 未结 1 988
误落风尘
误落风尘 2021-02-14 06:44

I\'m developing an android app.

Upon clicking a button, a deep-link is generated and shared with friends.

The problem is that upon clicking that shared deep-link

相关标签:
1条回答
  • 2021-02-14 07:45

    There are at least three things that could possibly be wrong:

    The way you are opening the url: I saw similar problem when writing the url to browser window on Android device. When adding the link to an email and clicking it, the app was opened. You write "click" so perhaps this is not the problem.

    Your url and your app/manifest do not match: You have not added proper intent handler for the protocol or the host to correct place in your manifest or your url does not match with what you have added. Or apn given in the url does not match your apps package name. Based on the question in the current state the host does not match.

    You are not sharing the deeplink url, but just an ordinary url: If you expect the shared url to open preinstalled app, your friends will need to click (on an email or similar) the complete deeplink url, which then either directs the link to play store (if app is not installed) or opens the app (if correctly implemented). Normal url is just opened in the browser. Based on the current state of the question, this could be the case.

    If fixing the above does not work: Try adding specific Android link to your url, something like this:

    https://<myappcode>.app.goo.gl/?link=http://domainname.com&apn=com.doman.app&amv=16&ad=0&al=myscheme://any-string-you-choose
    

    after which your intent filter should be something like this:

         <!-- [START link_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="any-string-you-choose" android:scheme="myscheme"/>
            </intent-filter>
            <!-- [END link_intent_filter] -->
    

    I prefer this way since it is a bit more flexible compared to using only link. Naturally the package name and other things need to be correct also when using this method. Android link is url to be opened only in android app, a bit poorly documented, check it from here (the example). Also my reply to another question gives some examples on how to use it.

    (edit 19.3.2018) It seems that Firebase does not fully support 'al=' anymore. The code works, but it is missing from the documentation and Firebase console generated urls.

    0 讨论(0)
提交回复
热议问题