Fixpoint
Fixpoint

Reputation: 9860

Intent filter with scheme and host does not work

I have a following intent filter:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="content" android:host="my.company.name" />
</intent-filter>

But it does not match the following Intent:

Uri uri = new Uri.Builder().scheme("content").authority("my.company.name").appendPath("names").build()
uri = Uri.withAppendedPath(uri, id1);
uri = Uri.withAppendedPath(uri, "data");

startActivity(new Intent(Intent.ACTION_VIEW, uri));

Why does this happen?

Upvotes: 3

Views: 2268

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006704

It may be that you cannot register an activity for the content scheme, as that is used by the content provider system.

If your activity really is backed by content providers, use the MIME type for the content instead, such as:

<data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />

If this relates to your other recent SO question, you may wish to follow the advice of the Google employee who answered that question. Here is a sample project demonstrating this technique, particularly the third <intent-filter> in the manifest.

Upvotes: 3

Related Questions