What is the default Account Type / Name for contacts on Android Contact Application?

后端 未结 3 1809
感动是毒
感动是毒 2020-12-03 11:42

I would like to read contacts from ContactsContract API which belongs only to Phone / SIM and would like to avoid contacts synced from other apps like facebook and gmail. I

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 12:05

    I made the same experiences as you did and can only suggest two workarounds:

    1. Let the user make the decision. For example show him a list of all raw contacts and then let him choose which one is a phonebook contact vs. a sim contact.

    2. My experience with three different devices is that the AccountManager is not aware of the account used to store those phonecontacts. For example when you fetch an account array from the AccountManager as you did (AccountManager.getAccounts()) the "com.htc.android.pcsc" is not in the list! But you can use exactly that fact to your advantage: Exclude all known account types/names and the list you get should be the list of all phonebookcontacts/simcontacts.

    Hopefully those ideas helped you :) I would like to read your thoughts about those workarounds, eventually I missed something or there is a even better workaround.

提交回复
热议问题