For more than two days now, I'm trying to grab a list of all contacts, from the internal addressbook (no facebook-, gmail- or twittercontacts) with their family- and givenname.
I managed to get a list with all contacts, socialcontacts included. So I looked at the account_types and saw that on my HTC Desire all the internal addressbook-contacts were from "com.htc.android.pcsc" and I was like "Great, I just have to filter the whole list". But then all people with non-htc android cellphones would be unable to use my app, if I would hardcode this filter.
Next idea was to let the user choose which account he wants to use, but unfortunately the "com.htc.android.pcsc" didn't appear in the list I got from the AccountManager?!?
So my question is: Is there any standardized way to access the internal adressbook? I'm really stuck with that and any hint is highly appreciated!
/edit: Maybe i didn't make my self clear enough. I can grab a contactlist, via the ContactsContract API:
ArrayList phoneContacts = new ArrayList();
String[] projection = new String[] {
Data.MIMETYPE,
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME
};
String selection = Data.MIMETYPE+" = '"+ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE+"'";
Cursor cursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI, projection, selection, null, null);
while (cursor.moveToNext()) {
phoneContacts.add(...);
}
cursor.close();
But then I have contacts from all the different accounttypes, like com.google / com.htc.socialnetwoork.facebook, etc.
And my question is: How can I filter all these socialnetwork- and gmailcontacts out, so I have a list with contacts, which are only from my internal addressbook?
/edit2: I found an example which describe the same difficulty I have: http://forum.synthesis.ch/showthread.php?t=2057 Synthesis AG had the same problem with their SyncML, that people complaining that they can't sync with their internal addressbook/phonebook only with gmail, facebook, etc. But they managed to seperate the internal addressbook from all these other accounttypes. So there must be a way to solve this problem, but I can't figure out how. Please help!