0

I am writing an app which uses the SyncAdapter framework. By default, the user has to activate the sync in the android account settings.

However, I was told that by calling ContentResolver.setIsSyncable (mAccount, AUTHORITY,1); I can activate the syncing without any user interaction.

Sadly, this doesn't seem to work. Even after a complete reinstall of the app, the sync adapter service is not running and the account settings look like this:(See screenshot below.)

What could I possibly be missing? Is it a problem maybe that I am calling ContentResolver.setIsSyncable (mAccount, AUTHORITY,1); from the content provider as opposed to the activity?

Screenshot account settings

Konstantin Schubert
  • 3,242
  • 1
  • 31
  • 46
  • As an aside, is there a way to make the graphic render a bit smaller? – Konstantin Schubert Jul 15 '15 at 19:44
  • Are you expecting to see something other than "Sync is OFF"? Have you also called `requestSync()`. `setSyncAutomatically()`, or `addPeriodicSync()` as described in a later section of the [training guide](https://developer.android.com/training/sync-adapters/running-sync-adapter.html) you referenced? – Bob Snyder Jul 15 '15 at 23:32
  • @qbix Sure I am also calling `requestSync()` :) . I am not sure what I am expecting to see in the settings, but I expect the sync to work without further user interaction. – Konstantin Schubert Jul 16 '15 at 16:12
  • If you followed the all the steps in the training guide, I probably can't suggest anything you don't already know. I'm not an expert, but I did implement a SyncAdapter using the guide and it is being invoked. Maybe double check the declaration of the adapter in your manifest and adapter meta-data. If you want to post them, I'd look at them and compare with mine. – Bob Snyder Jul 16 '15 at 16:23
  • @qbix Thanks for your help. The point is that the sync adapter is running after I check the little check box. So I guess my configuration is mostly fine. The issue I have is that the checkbox needs to be checked. I thought `setIsSyncable` would resolve this, but it doesn't. Hence my question. – Konstantin Schubert Jul 16 '15 at 21:03

0 Answers0