Android Deep linking using explicit intent

Currently I am having two web pages, home and about. The about is deep link in that ,so when i click on the link , android gives me the option to use a browser to or my own app to open that link. I would like to explicitly open that link in my app.I don't want list of the apps to handle it. Is this possible? Below is my code:

AndroidManifest.xml

    <activity
        android:name=".AboutPage"
        android:label="@string/about_page">
        <intent-filter android:label="@string/filter_name">
            <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="appindexing.robscv.info"
                  android:pathPrefix="@string/aboutHTML"/>
        </intent-filter>
    </activity>

AboutPage.java

public class AboutPage extends ActionBarActivity {

protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_page);

    // Enable the "Up" button for more navigation options
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    onNewIntent(getIntent());

}

protected void onNewIntent(Intent intent){
    String action = intent.getAction();
    String data = intent.getDataString();
    Log.d(action, data);
}
}

Upvotes: 2

Views: 862

Answers (1)

cjds
cjds

Reputation: 8426

In short. No

But

Its coming. This is a feature scheduled for release in Android M.

All you have to do is add this to the Manifest

<intent-filter android:label="@string/filter_name" android:autoVerify="true">
   //...categories etc
</intent-filter>

More info here


Just FYI what this will actually do is deep link directly to the app and if multiple apps on a users phone autoVerify then it will throw up the prompt.

Upvotes: 1

Related Questions