MilapTank
MilapTank

Reputation: 10076

Deep link not open app in http scheme

I have implemented Deep link in my application in manifest file I have define intent-filter like this

<activity
        android:name=".activity.ProfilePreviewActivity"
        android:theme="@style/AppTheme.ActionBar.Transparent">
        <intent-filter android:autoVerify="true" android:label="@string/app_name"
                       tools:targetApi="m">
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:host="appsdata2.cloudapp.net"
                  android:scheme="https"
            />
        </intent-filter>
        <intent-filter 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:host="appsdata2.cloudapp.net"
                android:scheme="http"
            />
        </intent-filter>

 </activity>

Now Problem is :

I have define scheme for both and also added android:autoVerify="true"

In Android 6.0.1 With app install

https scheme - url open app and work perfect

http scheme - url open browser not the actual App ? Am I missing something?

I have follow https://stackoverflow.com/a/39486914/1293313 but no luck

and In Android 7.1.1 With app install

https scheme - url open app and work perfect http scheme - url open app and work perfect (edited)

Upvotes: 2

Views: 4143

Answers (1)

Jaymin Panchal
Jaymin Panchal

Reputation: 2856

First check the link is reachable by adb or not by using:

adb shell am start -n com.example.simon.test/.activity.ProfilePreviewActivity

Just try below code because chrome has some issues in opening links.

<activity
         android:name=".activity.ProfilePreviewActivity"
         android:theme="@style/AppTheme.ActionBar.Transparent">

    <!-- For chrome links -->
    <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="appsdata2.cloudapp.net"
               android:scheme="http"
               android:pathPrefix="/"/>
    </intent-filter>

    <!-- For adb -->
    <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="appsdata2.cloudapp.net"
            android:scheme="http"/>
    </intent-filter>

 </activity>

Try to test the links form the browser <a href="http://appsdata2.cloudapp.net"></a>

Upvotes: 1

Related Questions