Thursday, 28 November 2019

how to use an intent-filter on customtabs using https scheme?

My app opens up a customtabs browser, and when the browser encounters a certain url I want to pop back open my app.

I found this posting that works - Android - create a schema for my app that will open from a webpage link using a protocol called "myapp"

I would prefer to use http/https protocol to trigger my app, but for some reason it doesn't seem to work.

Specifically this works:

       <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:scheme="myapp" />
       </intent-filter>

When the browser redirects to "myapp://10.2.2.0:3001/cats" my app opens back up, yay!

The problem is when I try this (or any of 100 other things I have tried)

            <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:scheme="https" android:host="10.0.2.2" />
                <data android:scheme="http" android:host="10.0.2.2" />
                <data android:pathPrefix="/cats" />
            </intent-filter>

When my app redirects to "http://10.2.2.0:3001/cats" It doesn't work, as a negative side effect also it asks me what I want to do when opening up customTabs (use google chrome, use a different app), no matter what I pick, the intent-filter doesn't get fired.

Is there a restriction on using http/https intent filters? What am I doing wrong?



from how to use an intent-filter on customtabs using https scheme?

No comments:

Post a Comment