I'm writing an Android app that accompanies a website and I wanted to make the app intercept certain URLs. I found multiple examples through Google and on SO but none of them work. I create my Intent:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://xgn.nl/article/" + String.valueOf(id))); and then launch it from another Activity (where i is the intent from above)
startActivity(i); The intent filter for the activity that should receive this is:
<activity android:name=".ArticleActivity" android:theme="@style/XGN.Red"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:scheme="http" android:host="xgn.nl" android:pathPrefix="/article/" android:mimeType="text/*" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> </activity> I also tried it without the mimeType in the filter. The intent resolver sees the filter but complains that the data does not match with the data in the intent and launches the browser instead.
What am I doing wrong?