我正在尝试向现有联系人添加新的RawContact,以便我的自定义数据字段显示在原始联系人中.我尝试将StructuredName数据行添加到我的新RawContact,其DisplayName与原始RawContact的DisplayName相匹配.我认为匹配的DisplayNames足以聚合两个RawContacts但联系人应用程序似乎将RawContacts显示为不同的联系人.
这是我的代码
public static void addContact(Context context, Account account, String number, String displayname) {
Log.e(Global.TAG, "adding contact: " + number + " / " + displayname);
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
//Create our RawContact
ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);
builder.withValue(RawContacts.ACCOUNT_NAME, account.name);
builder.withValue(RawContacts.ACCOUNT_TYPE, account.type);
operationList.add(builder.build());
//Create a Data record of common type 'StructuredName' for our RawContact
builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);
builder.withValueBackReference(ContactsContract.CommonDataKinds.StructuredName.RAW_CONTACT_ID, 0);
builder.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);
builder.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, displayname);
operationList.add(builder.build());
//Create a Data record of custom type "vnd.android.cursor.item/vnd.be.ourservice.profile" to display a link to the profile
builder …Run Code Online (Sandbox Code Playgroud) 有没有人找到一种方法来接听来自Htc Hero拨号器的拨出电话?
我目前在我的应用程序中使用NEW_OUTGOING_CALL意图,这适用于标准的Android拨号程序,但不适用于Htc Hero.英雄拨号器似乎没有触发那个特定的意图.
有没有其他方法来实现这一目标?