Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove my app from android account manager "add account"

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" />
like image 610
Kulibin Avatar asked Oct 22 '22 08:10

Kulibin


1 Answers

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.

like image 114
ozbek Avatar answered Nov 03 '22 17:11

ozbek