i wrote a custom syncadapter, which also added a custom field to the rawcontacts. Exactly how it is done in the SampleSyncAdapter or in this example with the last.fm-App. And it is working fine on the emulator.

The xml-file, which declares my custom field:

<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
    <ContactsDataKind
        android:mimeType="vnd.com.google.cursor.item/vnd.alien.mimetype"
        android:icon="@drawable/icon"
        android:summaryColumn="data2"
        android:detailColumn="data3"
        android:detailSocialSummary="true" />
</ContactsSource>

The code to add the custom field to the data-table of the contactscontract-provider:

mContentUri = Data.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
    Builder mID = ContentProviderOperation.newInsert(mContentUri)
            .withValue(Data.RAW_CONTACT_ID, getRawContactId())
            .withValue(Data.MIMETYPE, "vnd.com.google.cursor.item/vnd.alien.mimetype")
            .withValue(Data.DATA1, mContactInformations.get("mID"))
            .withValue(Data.DATA2, mContext.getString(R.string.profile_text))
            .withValue(Data.DATA3, mContext.getString(R.string.profile_id)+" "+mContactInformations.get("mID"));

But when I run them on my HTC Desire with HTC Sense installed, I can't see this custom field anymore?!? Has anyone experienced the same problem?

Any hint to get my custom field visible is highly appreciated!

Cheers Ali3n

有帮助吗?

解决方案 2

Unfortunately I did not found a real solution for that. But two things reduce the problem:

This problem did only appear on my old HTC Desire. On my sisters HTC Sensation the custom-field shows up as expected (nice fail from HTC in the first try oO)

Even better is, that the intent that would be started via this custom-field also shows up in the QuickContactBadge, which is used by the native HTC Contacts-App even on my HTC Desires Sense. Therefore the user can invoke my activity via the QuickContactBadge on old Senses versions and in new versions he also has the ability to use the custom-field.

其他提示

The default contact viewers do not show custom fields.

There are some 3rd party apps that do show custom fields, a free one (but ad supported) is here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top