I followed this tutorial to set up account for my application. After some struggle I managed to get everything working and my account is created.
if(mAccountManager.addAccountExplicitly(account, accountPassword, null)){
final Account availableAccounts[] = mAccountManager.getAccountsByType(intent.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));
CL.v("OK " + availableAccounts.length);
}else{
CL.v("FAIL");
}
mAccountManager.setAuthToken(account, authtokenType, authtoken);
After this code I receive that I have 1 account. Now when I close application and look in account manager there are no accounts associated with my application. And when I start my application
final Account availableAccounts[] = mAccountManager.getAccountsByType(intent.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));
doesn't return any accounts. I can create it as many times as I want, but it never get's saved. If I click "add new account" in Androids account manager then I see my application and clicking on it takes me to my Activity to create account, and after that everything happens as I described above. One more problem I'm having - there is no label for my application in Account manager, althou I define it in authenticator.xml as android:label="Label"
每当我测试我的应用程序时,它都会被删除,与此相关的所有帐户也会被删除。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.