How to edit accounts and sync settings for a specific account

The graphical OS menu "Accounts and Sync" has lists of user-configured Google accounts.

Please can someone point me in the right direction to programmatically change the synchronization settings associated with one of these accounts?

thank

+3
source share
3 answers

These settings use the new APIs AccountManager. Here is an example code example that shows how to add a new account. I would suggest that you want to get the credentials of one of the existing accounts and just change the data.

, API.

+2

, ContentResolver#setIsSyncable() , .

, android.provider.Settings.ACCOUNT_SYNC_SETTINGS EXTRA_AUTHORITIES ["google.com"] , , "account" Account, AccountManager. .

+1

ContentResolver.setSyncAutomatically(account, authority, true/false): , , .

+1

Source: https://habr.com/ru/post/1733420/


All Articles