How to avoid deep linking loop?

Viewed 1184

In my android app, I implemented a deep link so that when the user accessed my website, it offers to open it via my mobile app.

<activity
        android:name=".MyActivity"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">
        <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="myhost"
                android:pathPrefix="/myprefix"
                android:scheme="http" />
            <data
                android:host="myhost"
                android:pathPrefix="/myprefix"
                android:scheme="https" />
        </intent-filter>
    </activity>

Some of the features in my website is not implemented in the mobile. That's why I'm opening the browser for the user whenever they want to access that certain feature.

    try {
        Uri intentData = Uri.parse(url);
        Intent httpIntent = new Intent(Intent.ACTION_VIEW);
        httpIntent.setDataAndType(intentData, "text/plain"); //NON-NLS
        startActivity(httpIntent);
    } catch (Exception e) {
        //print error that user has no browser
    }

The problem I'm having is that, after opening the browser, chrome is asking the user whether they want to open the url via chrome or my app. I want to avoid that because I'm the one redirected them to the browser.

This thread is the only one I found related to my question, unfortunately it has no answer.

0 Answers
Related