Android SyncAdapter Automatycznie inicjuj synchronizację

mamSyncAdapter dla mojej aplikacji iAccountManager dodać moje konta aplikacji do Menedżera kont Android. Mój kod, kiedy dodam konto do Account Managera, wygląda następująco:

Bundle data = new Bundle(5);
data.putString(_PEOPLE_ID, people_id);
data.putString(_FIRST_NAME, first_name);
data.putString(_LAST_NAME, last_name);
data.putString(_PLAN, plan);
data.putString(_BIRTHDAY, birthday);
Account account = new Account(username, _ACCOUNT_TYPE);
try {
    boolean created;
    created = _account_manager.addAccountExplicitly(account,
                                   _cryptography.encrypt(_SEED, password), data);
    response.accountCreated(created);
    _account_manager.setAuthToken(account, _TOKEN_TYPE, session_token);
    _model.updateActiveAccount(people_id, username, password);
    SharedPreferences.Editor settings = _settings.edit();
    settings.putString(_ACCOUNT_TYPE, account.name);
    settings.putString(_TOKEN_TYPE, session_token);
    settings.commit();
    // Tells the content provider that it can sync this account
    ContentResolver.setIsSyncable(account, AUTHORITY, 1);
    final Bundle extras = new Bundle(1);
    extras.putBoolean(SYNC_EXTRAS_INITIALIZE, true);
    ContentResolver.addPeriodicSync(account, AUTHORITY, extras, 900);
} catch (Exception e) {
    Ln.e(e.getCause());
}

Mogę pomyślnie dodać konto do Account Managera poprzez Ustawienia, ale muszę także ręcznie włączyć synchronizację dla konta w Ustawieniach, nawet jeśli dane tła i synchronizacja są automatycznie włączone w emulatorze. Jeśli ręcznie włączę synchronizację, synchronizacja jest przeprowadzana prawidłowo, domyślnie nie jest uruchamiana.

questionAnswers(4)

yourAnswerToTheQuestion