Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I keep getting lots of notifications from this question, so I thought I'll share this info. This is how you add SyncAdapter without Account. You can put this in <code>onCreate</code> of <code>MyApplication extends Application</code> class. This assumes you already have a <code>SyncAdapter</code> and <code>ContentProvider</code> implemented. You can do that by following the tutorials listed in the question.</p> <pre><code>final String ACCOUNT_NAME = "MyApp"; final String ACCOUNT_TYPE = "com.myapp.account"; final String PROVIDER = "com.myapp.provider"; Account appAccount = new Account(ACCOUNT_NAME,ACCOUNT_TYPE); AccountManager accountManager = AccountManager.get(getApplicationContext()); if (accountManager.addAccountExplicitly(appAccount, null, null)) { ContentResolver.setIsSyncable(appAccount, PROVIDER, 1); ContentResolver.setMasterSyncAutomatically(true); ContentResolver.setSyncAutomatically(appAccount, PROVIDER, true); } </code></pre> <p>res/xml/syncadapter.xml</p> <pre><code>&lt;sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" android:contentAuthority="@string/provider" android:accountType="@string/account_type" android:userVisible="true" android:supportsUploading="true" /&gt; </code></pre> <p>res/xml/authenticator.xml</p> <pre><code>&lt;account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" android:accountType="@string/account_type" android:icon="@drawable/app_icon" android:smallIcon="@drawable/app_icon" android:label="@string/app_label" /&gt; </code></pre>
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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