Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> Account account = new Account(username, AuthConstants.ACCOUNT_TYPE); if (am.addAccountExplicitly(account, password, null)) { result = new Bundle(); ContentResolver.setSyncAutomatically(account, DB.AUTHORITY, true); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); return result; } </code></pre> <p>I am using this code in one of my apps which works perfectly. the key here is the AccountAuthenticatorActivity that should set the authentication result bundle which should be registered (the sync adapter from android developers has this.</p> <p>also here is my addAccount method for the accountAuthentication service</p> <pre><code> @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { final Intent intent = new Intent(mContext, LoginScreen.class); intent.putExtra(LoginScreen.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; } </code></pre> <p><strong>UPDATE</strong></p> <p><a href="http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/" rel="nofollow">Authenticator</a></p> <p>Here is a link i used. this is a good project. i believe it is from the last.fm android app. it also has the source code open on git i believe. so try to compare with that.</p> <p><strong>PERMISSIONS</strong></p> <pre><code>&lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /&gt; &lt;uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /&gt; &lt;uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /&gt; &lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt; &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /&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. 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