Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.accounts.AuthenticatorException: bind failure

Tags:

android

I am getting the following exception; I know its not much to go on, but there seems little to no working documentation out there. Suffice it to say, I have tried all the examples on implementing my own Authenticator.

I have found a proposed answer here to fix my Manifest-File (declaring the service). Had already done that, problem persisting.

My initial solution is based on this example: write-your-own-android-authenticator

W/System.err﹕ android.accounts.AuthenticatorException: bind failure

W/System.err﹕ at Android.accounts.AccountManager.convertErrorToException(AccountManager.java:2024)

W/System.err﹕ at android.accounts.AccountManager.access$400(AccountManager.java:144)

W/System.err﹕ at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1867)

W/System.err﹕ at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)

W/System.err﹕ at android.os.Binder.execTransact(Binder.java:446)
like image 484
Tobias Gassmann Avatar asked Aug 16 '15 13:08

Tobias Gassmann


1 Answers

I had the same situation. Searched everywhere but no luck. There are actually very few resources and tutorials for android authenticator. I also referred the same article udinic:write your own android authenticator.

It's not so detailed and its easy to get lost. I actually changed my accountType in authenticator.xml and forgot to change in AccountGeneral class. Both should be same, otherwise you activity won't bind to AuthenticatorService for callbacks.

authenticator.xml

<?xml version="1.0" encoding="utf-8" ?><account-authenticator 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="your_account_type_name"
    android:icon="@drawable/ic_navigate_before"
    android:smallIcon="@drawable/ic_navigate_before"
    android:label="@string/label"
    android:accountPreferences="@xml/prefs"/>

AccountGeneral.java

public class AccountGeneral {

/**
 * Account type id
 */
public static final String ACCOUNT_TYPE = "your_account_type_name";

/**
 * Account name
 */
public static final String ACCOUNT_NAME = "your_account_name";

/**
 * Auth token types
 */
public static final String AUTHTOKEN_TYPE_READ_ONLY = "Read only";
public static final String AUTHTOKEN_TYPE_READ_ONLY_LABEL = "Read only access to an FitDodo account";

public static final String AUTHTOKEN_TYPE_FULL_ACCESS = "Full access";
public static final String AUTHTOKEN_TYPE_FULL_ACCESS_LABEL = "Full access to an FitDodo account";

public static final ServerAuthenticate sServerAuthenticate = new ParseComServerAuthenticate();

}

I hope you find this helpful.

like image 105
Prince Bansal Avatar answered Nov 19 '22 12:11

Prince Bansal