SyncAdapter has stopped syncing

Our implementation of SyncAdapter does not sync with Android 4.4.4. Works well with lower APIs.

Our application uses AbstractThreadedSyncAdapter to communicate with the server. I tested it with many different devices and models, running Android from API level 10. Recently, we purchased two devices based on Android 4.4.4 (Moto E, Nexus 5) and began to experience problems with SyncAdapter. Here's the xml config:

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" android:contentAuthority="our.provider" android:accountType="our.authenticator" android:userVisible="false" android:allowParallelSyncs="false" android:isAlwaysSyncable="true" android:supportsUploading="true" /> 

Even if I put the manual and accelerated flags, the synchronization does not start:

 Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(SyncAdapter.dummyAccount(context), SYNC_PROVIDER, bundle); 

I tried this over Wi-Fi and plugged in the power cord to eliminate any optimizations related to energy usage. The target SDK is installed in the latest version:

 <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="20" /> 

And I have all the necessary permissions :

 <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> <uses-permission android:name="android.permission.READ_SYNC_STATS" /> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> 

One thing that seems unusual to me. Devices report an API = 19 level, but the SDK says that API 19 is equivalent to Android 4.4. 2 , not android 4.4.4:

Android 4.4.2 = API level 19

Could this be related to this problem?

Sorry for not being more helpful or descriptive, but I really don't know how to continue debugging this problem. Thanks in advance.

Edit

Further thoughts:

+5
source share
1 answer

Not responding can help. This is, to my knowledge, a completely minimal SyncAdapter.

In the example, there is no AccountAuthenticator component. AccountAuthenticator is required only if there are calls to one of the getAuthToken methods.

As noted in the comments, I tried to duplicate your problem using this minimal example, and could not do it. Perhaps you can start with this and build something that fails.

+3
source

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


All Articles