mauron85 / react-native-background-geolocation

Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.
Apache License 2.0
1.33k stars 559 forks source link

Does't auto sync. #550

Closed velialan closed 2 years ago

velialan commented 2 years ago

SyncService.java

ContentResolver.setMasterSyncAutomatically(true);


public static void sync(Account account, String authority, boolean manual) {
        // Pass the settings flags by inserting them in a bundle
        Bundle settingsBundle = new Bundle();
        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, manual);
        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, manual);
        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false);
        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, true);

        /*
         * Request the sync for the default account, authority, and
         * manual sync settings
         */
        ContentResolver.setMasterSyncAutomatically(true);// enables AutoSync 
        ContentResolver.requestSync(account, authority, settingsBundle);
    }

app sync setting auto enabled solved my problem