In an Android app I’m working on, I’m using the AccountManager to store the user’s account info and also sync a couple of sources (I have two services that respond to the android.content.SyncAdapter intent action).
However, I am not syncing contacts. In spite of this, if I go in the contacts app and choose to add a contact, I get a popup asking me under which account should the contact be created. The account created by my app is listed there as well. I have tried putting android:supportsUploading="false" on my <sync-adapter>s, doesn’t work.
The only solution I currently see is to create an empty, invisible contact sync service that has android:supportsUploading="false", but that seems like the biggest and most useless hack ever.
Help?
It appears to me that you have to specify both
android:supportsUploading="false"AND your content authority must beandroid:contentAuthority="com.android.contacts"(ContactsContract.AUTHORITY).See
com.android.contacts.model.Sources.queryAccounts(), which fills in the .readOnly flag, andcom.android.contacts.model.Sources.getAccounts(), which is used bycom.android.contacts.util.AccountSelectionUtil.getSelectAccountDialog()to populate the contacts dialog.What’s not clear to me is whether this has additional (potentially undesirable) side effects — particularly given that you’re specifying a contentAuthority that is conceptually the opposite of what you want.
-Tim