0

How do I use AbstractThreadedSyncAdapter for minSDK lower than API-11? The following constructor is complaining about needing API-11.

public DogSyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
    super(context, autoInitialize, allowParallelSyncs);
  }
learner
  • 11,490
  • 26
  • 97
  • 169

1 Answers1

0

As it says in the documentation:

Api level 5:

public AbstractThreadedSyncAdapter (Context context, boolean autoInitialize)

Api level 11:

public AbstractThreadedSyncAdapter (Context context, boolean autoInitialize, boolean allowParallelSyncs)

So you just need to implement both constructors, and then call one or other:

if (sSyncAdapter == null) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                    sSyncAdapter = new NotificationsSyncAdapter(getApplicationContext(), true, true);
                } else {
                    sSyncAdapter = new NotificationsSyncAdapter(getApplicationContext(), true);
                }
            }
alorma
  • 924
  • 8
  • 10
  • So there is no parallel sync convenience in API less than 11? That was essentially the gist of my question. Sorry for not being clear. – learner Sep 07 '15 at 19:20
  • No, below 11 you cannot have parallel syncs – alorma Sep 07 '15 at 19:21
  • wow. That's too bad. I was hoping I could use `android.support.v4.content. AbstractThreadedSyncAdapter`. That's quite a bummer. – learner Sep 07 '15 at 19:47