Add account automatically

…衆ロ難τιáo~ 提交于 2019-11-29 02:39:05

There is Android AtLeap library which contains helper classes to use Account Authenticator. Have a look at it https://github.com/blandware/android-atleap

A bit late but...

Account account = new Account("Title", "com.package.nom");
String password = "password";
AccountManager accountManager = AccountManager.get(context);
accountManager.addAccountExplicitly(account, password, null);

Don't you have to add to the following code posted by Evan Elliott :

Account account = new Account("Title", "com.package.nom");
String password = "password";
AccountManager accountManager = AccountManager.get(context);
accountManager.addAccountExplicitly(account, password, null);

The following: ?

authenticator.xml

<?xml version="1.0" encoding="utf-8"?>

 <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/account_type"
    android:icon="@drawable/icon_hdpi"
    android:smallIcon="@drawable/icon_hdpi"
    android:label="@string/authenticator_label"
 />

and permissions?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!