简体   繁体   中英

How to not work Android intent-filter host from my domain?

<intent-filter android:label="@string/app_name" android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http"
                  android:host="mydomain.com"
                  android:pathPrefix="/path" />
</intent-filter>

I set android Manifest like above for Firebase App-Indexing. It works well. But when user visit my domain with internet browser and click something on my content(eg. "mydomain.com/path?key=100"), my app is opened. Because I have set like that. It's very annoying.

My intention is I want to lead to my app but not from my website. User is already in my website. I don't want to disturb them.

How can I prevent opening app only from my website?

From Android Deep linking , BROWSABLE category is

required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app.

Also for the DEFAULT category :

allows your app to respond to implicit intents. Without this, the activity can be started only if the intent specifies your app component name.

I would suggest removing the DEFAULT category from this intent filter as then it won't implicitly lead to your app.

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