【问题标题】:What is the mimeType from adding an intent filter for sharing a contact?添加用于共享联系人的意图过滤器的 mimeType 是什么?
【发布时间】:2013-10-26 22:33:39
【问题描述】:

如何将我的应用注册为可以共享联系信息的应用?

例如,注册为分享图片的应用程序是这样完成的:

<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*" />
</intent-filter>

我用谷歌搜索了它,但我找不到“联系人”mimType

【问题讨论】:

    标签: android android-contacts intentfilter


    【解决方案1】:

    联系人通常表示为 vcard,因此 mime 类型将设置为:

    <data android:mimeType="text/x-vcard" />
    

    但谷歌有一个特定的联系人item type

    <data android:mimeType="vnd.android.cursor.item/contact" />
    

    【讨论】:

    • 我对它们都进行了测试,只有 text/x-vcard 有效。 vnd.android.cursor.item/contact 在什么情况下应该起作用?
    • 不知道,我只用过vcard。起初我打算只回答 vcard,但由于另一个在文档中,所以我把它放在这里,这样你也可以测试。
    • 谢谢,我接受了这个答案。您是否还知道在收到 text/x-vcard 意图后如何获取电话号码?我只喜欢以下显示如何将其转换为字符串的帖子:stackoverflow.com/questions/12659323/…
    • 这个答案展示了如何将其转换为联系stackoverflow.com/a/4600085/562840
    猜你喜欢
    • 1970-01-01
    • 2012-05-05
    • 2021-11-10
    • 2016-10-24
    • 1970-01-01
    • 1970-01-01
    • 2014-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多