accountmanager

Disallow multiple accounts in AccountManager

女生的网名这么多〃 提交于 2019-12-18 12:23:28
问题 I've implemented my AccountManager authenticator and the service and the whole deal and it all seems to be working fine. There is, however, one little problem: I only want a single account for my app to exist in account manager, but can't quite seem to find a way to limit this. Is my only solution to do a search and delete the current accounts (by type) before adding the new account? My current code: private void removeAccounts() { Account [] accounts = mAcctMgr.getAccountsByType

Twitter Authentication through Android's AccountManager classes

泄露秘密 提交于 2019-12-18 11:34:02
问题 I am working on a twitter based app and am trying to incorporate Android's built-in Account support for Twitter. The following code works to popup the confirmation dialog for my app to access twitter but I am unsure of what to pass in as the authenticationType. Any help would be appreciated. I've googled all over the place and can't seem to find the correct answer. It goes in place of "oauth" below. AccountManager am = AccountManager.get(this); Account[] accts = am.getAccountsByType(TWITTER

New contact creating rather than updating existing contact

梦想的初衷 提交于 2019-12-18 07:05:45
问题 I am integrating my app with android default Contacts application.I would like to show an option "xyz using MyApp" inside every Contacts Detail.I am able to see my app in Accounts Section with an option to sync Contacts but still my app not merging with existing contacts but instead creating a new contact and merging in it. performSync() method private static void addContact(ContentResolver contentResolver,int name, int phoneNumber) { Log.i("XYZ", "Adding contact: " + name); ArrayList

How to retrieve an Facebook-AuthToken from the accounts saved on Android

て烟熏妆下的殇ゞ 提交于 2019-12-17 19:23:05
问题 I'm trying to retrieve the AuthToken for Facebook (saved by Facebook for Android ) by using the following piece of code. AccountManager am = AccountManager.get(this); Account[] accounts = am.getAccountsByType("com.facebook.auth.login"); if (accounts.length > 0) { for(int j = 0; j < accounts.length; j++) { Account account = accounts[j]; if(account.type != null && account.type.equals("com.facebook.auth.login")) { Log.e(RuntimeVars.MY_NAME, "FACEBOOK-TYPE FOUND"); am.getAuthToken(account, "com

What should I use Android AccountManager for?

此生再无相见时 提交于 2019-12-17 02:26:48
问题 I've seen AccountManager in the Android SDK and that it is used for storing account information. Thus, I cannot find any general discussion of what it is intended for. Does anyone know of any helpful discussions of what the intention behind AccountManager is and what it buys you? Any opinions of what type of Accounts this is suitable for? Would this be where you'd put your user's account information for a general web service? 回答1: This question is a bit old, but I think it is still of good

Accountmanager Auth token whithout clientID and clientSecret

情到浓时终转凉″ 提交于 2019-12-14 01:53:01
问题 Hello I'm retrieving a auth token on my app with that code : private String updateToken(boolean invalidateToken, int accountref) { String authToken = "null"; try { AccountManager am = AccountManager.get(TestAuthActivity.this); Account[] accounts = am.getAccountsByType("com.google"); AccountManagerFuture<Bundle> accountManagerFuture; if(TestAuthActivity.this == null){//this is used when calling from an interval thread accountManagerFuture = am.getAuthToken(accounts[accountref], SCOPE_CONTACTS

Android - How to protect or delete an account when application is uninstalled?

左心房为你撑大大i 提交于 2019-12-13 15:43:06
问题 Following Udinic's blog shows us how to create our own authenticator and manage our own accounts. The problem is that if two applications try to manage the same account type, only the account authenticator of the first application will be used (and only the first application can access certain methods of the AccountManager). However, if the first application is uninstalled, then the second application's account authenticator takes its place and the second application has full access to the

Get the Google ID used to download the application

房东的猫 提交于 2019-12-13 11:57:09
问题 How can i find out which google account downloaded the application? This question is related to Get the Google ID used in an in-app billing purchase Thank you! 回答1: I think the best answer can be found here: How to get the Android device's primary e-mail address This might not be exacly what you want, but without asking the user, I think this is the closest you can get. 来源: https://stackoverflow.com/questions/10245250/get-the-google-id-used-to-download-the-application

Put your app account in Auto-Sync settings android

我的梦境 提交于 2019-12-13 04:57:18
问题 I am new on this so i do not find the answer on the internet or i am not sure if the answer is that. What i am trying to do is to make my app sync all the contacts in the native contact app like whatsapp or facebook does. I also wanted to link contacts. Any hint or tutorial would be great. Something like this: What are the benefits of putting my app over there? I am very new on this. Please I hope an answer do not vote down D:. Any answer is welcome. 回答1: Account Manager requires several key

Can't get default account in OREO

人盡茶涼 提交于 2019-12-12 20:18:09
问题 In Android Oreo, AccountManager.getAccountsByType("com.google"); returns null . Its, working fine in below Android 8 versions. Below is my code: private static Account getAccount(AccountManager accManager) { Account[] accounts = accManager.getAccountsByType("com.google"); Account account; if (accounts.length > 0) { account = accounts[0]; } else { account = null; } return account; } Thanks in advance. 回答1: As per Android's update, from Oreo onwards we can not use AccountManager