There is no activity to handle Intent {act = android.accounts.AccountAuthenticator}, although I have one

I try to have my application display my login activity when the user selects "Add Account" in "Accounts & Sync" or wants to use the application and has not logged in yet. I followed the SampleSyncAdapter example pretty closely , but I can't get it to work and get the following exception instead:

No Activity found to handle Intent { act=android.accounts.AccountAuthenticator }

My authorization service contains:

public IBinder onBind(Intent intent) {
    IBinder ret = null;
    if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)){
        ret = getAuthenticator().getIBinder();
    }
    return ret;
}

My AndroidManifest.xml:

<service android:name=".auth.MyAuthService"
         android:exported="true" 
         android:process=":auth">
    <intent-filter>
        <action android:name="android.accounts.AccountAuthenticator" />
    </intent-filter>

    <meta-data android:name="android.accounts.AccountAuthenticator"
               android:resource="@xml/authenticator" 
    />

My main activity:

startActivity(new Intent(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT));

I tried to do both:

Intent svc = new Intent(this, CreazaAuthService.class);
startService(svc);

and:

bindService(new Intent(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT), null, BIND_AUTO_CREATE);

startActivity(), - . , ActivityNotFoundException.

?


c99 last.fm, , android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT. ? ?

+3
1

<category android:name="android.intent.category.DEFAULT" />

+12

Source: https://habr.com/ru/post/1752104/


All Articles