Synchronizer without internet connection

I have a sync adapter that works great. It does not require an Internet connection, because it needs to synchronize the address book with another local storage (my application). When Wi-Fi is disconnected and the device has no internet connection, Android disables synchronization in account activity and synchronization.

Is there a way to enable my sync adapter even if the connection is disconnected?

+5
source share
4 answers

Add extra SYNC_EXTRAS_MANUAL before callingrequestSync(account,authority, extras);

extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
ContentResolver.requestSync(account,authority, extras);
0
source

In SyncManager, try setting mDataConnection to true when the account type is yours.

0

Well there is no way, the SyncAdpater infrastructure will not work without an Internet connection. Therefore, it is better to reinstall your sync adapter as an intent service.

0
source
 public static void requestManualSync(Account account, Bundle extras) {
   //Do your Stuff here...
}

Use the method above in the Syncadapter ..

0
source

All Articles