简体   繁体   中英

Android deep-links (intents): different behaviour between devices

this whole subject took some precious time from my life, and still isn't 100% solved, hope i could find some answers here.

EXPECTED RESULT: when tapping a link to my app ( http://www.myapp.com ), if app is installed , os should open a dialog where user chooses the app to open this link (my app or browser), if app isn't installed should normally browse this url with the browser.

ACTUAL RESULT:

on Samsung devices , tapping the link ( http://www.myapp.com ) gives the expected result, a dialog opens prompting me to choose an app to open this with, including my app.

on Nexus devices , on the other hand, it acts like the app isn't installed, and it just browses the url with the browser with no prompting to choose an app to open.

How to get Nexus devices to support this flow as well? like Samsung devices?

this is how i registered the activity in my app manifest:

<activity
    android:name=".activities.MainActivity2"
    android:configChanges="keyboardHidden|screenSize"
    android:theme="@style/application_theme_header_green">
    <intent-filter >
        <data android:scheme="http" android:host="www.myapp.com" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>

hope i provided all needed info.

thanks all.

Try replacing

<data android:scheme="http" android:host="www.myapp.com" />

With

<data android:scheme="http" />
<data android:host="www.myapp.com" />

This looks like the only difference between what I have and what you've posted, and it works on Nexus devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM