应用程序的预定义动作。从联系人链接到我的应用程序 [英] Predefined actions of application. Link to my application from Contacts

查看:119
本文介绍了应用程序的预定义动作。从联系人链接到我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写与联系人连接的应用程序。



情景:


  1. 输入电话联系人

  2. 我们选择联系人项目


  3. 我的应用程序的图标应该出现在QuickAction对话框中。


  4. 我点击了我的应用程序图标,Aplication从联系人记录中的数据开始。

我必须添加到AndroidManifest才能做到这一点?

解决方案

为您的应用添加此意图过滤器,以便所有联系人都可以看到。

 < intent -filter> 
< action android:name =android.intent.action.VIEW/>
< category android:name =android.intent.category.DEFAULT/>
< data android:mimeType =vnd.android.cursor.item / name/>
< / intent-filter>

更改mimetype,以便只有具有特定数据的联系人才有您的活动。



例如,如果您希望活动只显示联系人的电子邮件,然后将mimetype更改为 vnd.android.cursor.item / email_v2 。您可以从 DataColumns 的子类获取mimetype名称。 p>

I want to write application which is connected with Contacts.

Scenario :

  1. Enter to phone Contacts
  2. We choose Contact item

  3. And icon of my application should appear in QuickAction Dialog.

  4. I click on my app icon and Aplication start with data from contact record.

What I have to add to AndroidManifest to do it?

解决方案

Add this intent filter for your app to be visible for all contacts.

    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="vnd.android.cursor.item/name" />
    </intent-filter>

Change the mimetype, so that only contacts with a particular data have your activity.

e.g if you want your activity to show only for contacts with email then change mimetype to vnd.android.cursor.item/email_v2 . You can get the mimetype names from the subclasses of DataColumns

这篇关于应用程序的预定义动作。从联系人链接到我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆