LittleFunny
LittleFunny

Reputation: 8405

Android: SyncAdapter how do I start the auto sync

I have the auto sync running if I select the checkbox through the Setting/Account screen. If I set the UserVisible in the syncadapter.xml to false, I can't select the check box. How to start the auto sync without the option in setting screen.

Upvotes: 1

Views: 449

Answers (1)

SushiHangover
SushiHangover

Reputation: 74209

To manually invoke a sync you call RequestSync with at least the Account and Authority string that you have already created for your SyncAdapter.

ContentResolver.RequestSync(account, authority, null);

That will have OS start your registered sync Service and thus your SyncAdapter.

Re: https://developer.android.com/reference/android/content/ContentResolver.html#requestSync(android.accounts.Account,%20java.lang.String,%20android.os.Bundle)

Upvotes: 1

Related Questions