Skip to content Skip to sidebar Skip to footer

Update Contact Pictures - Support Other Providers Like Outlook

The code at the bottom shows how I update contact pictures from my app. This works well, if the user uses sim, phone and google contacts and similar. But if he uses the outlook app

Solution 1:

Each SyncAdapters has a configuration called supportsUploading set to either true or false. You shouldn't modify RawContacts of accounts there were synced by a SyncAdapter with supportsUploading set to false, as most likely your change will probably get overwritten by the SyncAdapter soon after.

You can check the supportsUploading value of all SyncAdapters using the following code:

final SyncAdapterType[] syncs = ContentResolver.getSyncAdapterTypes();
for (SyncAdapterType sync : syncs) {
    Log.d(TAG, "found SyncAdapter: " + sync.accountType);
    if (ContactsContract.AUTHORITY.equals(sync.authority)) {
        Log.d(TAG, "SyncAdapter supports contacts: " + sync.accountType + " - supportsUploading=" + sync.supportsUploading());
    }
}

In order to set a different pic to a contact synced by a read-only SyncAdapter, you can create a new RawContact under your own account (preferably under your own SyncAdapter) and join that new RawContact with the existing RawContact created by Outlook, then you can set SUPER_PRIMARY on your own picture, so it'll be the default one.

Post a Comment for "Update Contact Pictures - Support Other Providers Like Outlook"