Question

When user create new account in my app, I create new account in android account manager. So user can see his account in settings->accounts and synch...

So question: is it possible to remove my app from list when user click "add new account" in accounts and synch? User should not see my app in this list, but still can create account in my app.

PS. I don't want to open activity when clicked add account, I just want not display my app point in list.

I have in my manifest:

 <service
        android:name="myPackage.authenticator.AuthenticationService"
        android:exported="false" >
        <intent-filter>
            <action android:name="android.accounts.AccountAuthenticator" />
        </intent-filter>

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

And my authenticator:

<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="myType"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:smallIcon="@drawable/ic_launcher" />
Was it helpful?

Solution

As far as I understand, you do not want users to have multiple accounts of your service in a device. I see two options here:

  1. Manage if user has already added an account. When user navigates to Settings > Accounts > Add account and choose your service, you will check if there is any registered account on the device. If there is, reject the new authentication.

  2. Disable "myPackage.authenticator.AuthenticationService" right after user adds her first account (may not be safe), so that system (Settings app) will not be able to locate your service when it is parsing for authentication providers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top