开发者

How to edit accounts & sync settings for a specific account

开发者 https://www.devze.com 2022-12-20 10:14 出处:网络
Under the \'Accounts & Sync\' settings graphical OS 开发者_如何学Cmenu, there are listings of user-configured Google accounts.

Under the 'Accounts & Sync' settings graphical OS 开发者_如何学Cmenu, there are listings of user-configured Google accounts.

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

Thanks


Those settings use the new AccountManager APIs. Here's some sample code that shows how to add a new account. I'd assume that you'd want to get the credentials of one of the existing accounts and simply modify the data.

Unfortunately, I haven't had a chance to try out those APIs yet.


Maybe ContentResolver#setIsSyncable() can do what you want.

Perhaps would be better to fire the android.provider.Settings.ACCOUNT_SYNC_SETTINGS intent with either the EXTRA_AUTHORITIES extra set to ["google.com"], or possibly put the extra named "account" as the Account object you got from AccountManager. Then your user can turn their sync on or off for themselves.


ContentResolver.setSyncAutomatically(account, authority, true/false): sets whether or not the provider is synced when it receives a network tickle.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号