1

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

Christoph Haefner
  • 1,093
  • 1
  • 9
  • 25

2 Answers2

1

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

SoftWyer
  • 1,986
  • 28
  • 33
  • I installed it right away, but also this App doesn't show my custom field -.- I will post the code how I add this custom field, maybe I make a mistake there. – Christoph Haefner Feb 20 '12 at 16:16
  • Really weird, as it is working nicely with the emualtor and a testphone running CyanogenMod 7. – Christoph Haefner Feb 20 '12 at 16:22
  • Try changing the mime type for the custom field? Contact View uses the Android custom mime type which is `vnd.com.google.cursor.item/contact_user_defined_field` – SoftWyer Feb 20 '12 at 20:56
  • Thanks for that hint, I changed the mimetype in my code. But my custom field still is not showing up, neither in HTC Sense nor in Contact View. But it is still working in the emulator -.- – Christoph Haefner Feb 21 '12 at 16:44
  • I wrote an eMail to the developer of contact view and asked what prepreferences a custom field needs to fulfill to be shown by their app. If I get an answer I will post back the results. We will see how this turns out .... – Christoph Haefner Feb 22 '12 at 15:41
0

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.

Christoph Haefner
  • 1,093
  • 1
  • 9
  • 25