用于查看/编辑/插入的 Android Intent 过滤器

发布于 2024-09-13 06:20:48 字数 5642 浏览 18 评论 0原文

我一直在努力寻找一个或所有合适的过滤器。有人有吗?在底部您可以看到意图的日志输出。也许它们不是公开的?

在我的代码中尝试了以下无济于事...

  <receiver android:name=".ContactsBroadcastReceiver" android:label="@string/broadcast_receiver_name" android:enabled="true">
       <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/person" android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.dir/contact" android:host="com.android.contacts" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_DEFAULT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_CONTACTS" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_ALL_CONTACTS" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_CONTACTS_WITH_PHONES" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/starredList">
            <action android:name="com.android.contacts.action.LIST_STARRED" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/frequentList">
            <action android:name="com.android.contacts.action.LIST_FREQUENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/strequentList">
            <action android:name="com.android.contacts.action.LIST_STREQUENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.INSERT_OR_EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person" />
            <data android:mimeType="vnd.android.cursor.item/contact" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:pathPrefix="raw_contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:path="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:pathPrefix="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.INSERT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:path="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
            <!--
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts flg=0x10000000 cmp=com.android.contacts/.DialtactsContactsEntryActivity bnds=[324,598][480,718] }
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.EDIT dat=content://com.android.contacts/raw_contacts/26 cmp=android/com.android.internal.app.ResolverActivity }
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.INSERT dat=content://com.android.contacts/contacts cmp=com.android.contacts/.ui.EditContactActivity }
             -->
        </intent-filter>
  </receiver>   

I've been trying to find one or all of the right filters. Does anyone have them? Down at the bottom you can see the logging output of the intents. Perhaps they aren't public?

Have tried the following in my code to no avail...

  <receiver android:name=".ContactsBroadcastReceiver" android:label="@string/broadcast_receiver_name" android:enabled="true">
       <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/person" android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.dir/contact" android:host="com.android.contacts" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_DEFAULT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_CONTACTS" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_ALL_CONTACTS" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="com.android.contacts.action.LIST_CONTACTS_WITH_PHONES" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/starredList">
            <action android:name="com.android.contacts.action.LIST_STARRED" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/frequentList">
            <action android:name="com.android.contacts.action.LIST_FREQUENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter android:label="@string/strequentList">
            <action android:name="com.android.contacts.action.LIST_STREQUENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.TAB" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.INSERT_OR_EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person" />
            <data android:mimeType="vnd.android.cursor.item/contact" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:pathPrefix="raw_contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.SHOW_OR_CREATE_CONTACT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:path="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:pathPrefix="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
        </intent-filter>
        <intent-filter>
            <action android:name="com.android.contacts.action.INSERT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content" android:host="com.android.contacts" android:path="contacts" 
             android:mimeType="vnd.android.cursor.dir/contact"/>
            <!--
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.contacts/contacts flg=0x10000000 cmp=com.android.contacts/.DialtactsContactsEntryActivity bnds=[324,598][480,718] }
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.EDIT dat=content://com.android.contacts/raw_contacts/26 cmp=android/com.android.internal.app.ResolverActivity }
            I/ActivityManager( 1212): Starting activity: Intent { act=android.intent.action.INSERT dat=content://com.android.contacts/contacts cmp=com.android.contacts/.ui.EditContactActivity }
             -->
        </intent-filter>
  </receiver>   

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追我者格杀勿论 2024-09-20 06:20:48

这对我有用:

        <intent-filter android:label="Edit Contact">
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person"
                android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.item/contact"
                android:host="com.android.contacts" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact"
                android:host="com.android.contacts" />
        </intent-filter>
        <intent-filter android:label="Create Contact">
            <action android:name="android.intent.action.INSERT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/person" />
            <data android:mimeType="vnd.android.cursor.dir/contact" />
            <data android:mimeType="vnd.android.cursor.dir/raw_contact" />
        </intent-filter>
        <intent-filter android:label="View Contact">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person"
                android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.item/contact"
                android:host="com.android.contacts" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact"
                android:host="com.android.contacts" />
        </intent-filter>

This worked for me:

        <intent-filter android:label="Edit Contact">
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person"
                android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.item/contact"
                android:host="com.android.contacts" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact"
                android:host="com.android.contacts" />
        </intent-filter>
        <intent-filter android:label="Create Contact">
            <action android:name="android.intent.action.INSERT" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/person" />
            <data android:mimeType="vnd.android.cursor.dir/contact" />
            <data android:mimeType="vnd.android.cursor.dir/raw_contact" />
        </intent-filter>
        <intent-filter android:label="View Contact">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/person"
                android:host="contacts" />
            <data android:mimeType="vnd.android.cursor.item/contact"
                android:host="com.android.contacts" />
            <data android:mimeType="vnd.android.cursor.item/raw_contact"
                android:host="com.android.contacts" />
        </intent-filter>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文