Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid SyncAdapter Automatically Initialize Syncing
    primarykey
    data
    text
    <p>I have a <code>SyncAdapter</code> for my app, and an <code>AccountManager</code> to add my apps accounts to the Android Account Manager. My code for when I add an account to the Account Manager looks like:</p> <pre><code>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()); } </code></pre> <p>I can add the account to the Account Manager successfully through Settings, but I have to manually enable syncing for the account in Settings also, even though background data and sync automatically settings are enabled on the emulator. If I manually enable syncing, then the sync is performed fine, it just isn't started by default.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload