accountmanager

Android Login - Account Authenticator vs Manual Authentication

谁说我不能喝 提交于 2019-11-28 15:32:16
I'm about to implement login along with user authentication in my app. My first idea was to do it manually, register username and password with the server, get auth token, save it and use it in subsequent requests. After googling around, I gathered that the correct way to do it on Android was using Account Authenticator. I've seen a few examples of it's implementation but I don't understand the advantage of doing it this way? Is it because I can have more than one account stored? Is it because of syncing issues? I'd appreciate if someone could explain this to me. It would probably make me

Why is my AccountAuthenticatorActivity not launching when triggered by another app?

☆樱花仙子☆ 提交于 2019-11-28 14:38:23
I have a suite of apps and my AccountManager files live in one central app. I can use AccountManager.AddAccount() in that central app, but when I try to use that method from the other apps, the AuthenticatorActivity is not started. I can debug and see that all of the code from AddAccount is being executed, but the activity is never launched. Here is my AddAccount method: public override Bundle AddAccount(AccountAuthenticatorResponse response, string accountType, string authTokenType, string[] requiredFeatures, Bundle options) { var intent = new Intent(_context, typeof

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

我只是一个虾纸丫 提交于 2019-11-28 10:17:56
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.facebook.auth.login", null, ConversationList.this, new AccountManagerCallback<Bundle>() { public void

AuthToken from AccountManager in Android Client No Longer Working

£可爱£侵袭症+ 提交于 2019-11-28 02:52:55
I'm pretty exasperated. I'm attempting to build a turn-based multiplayer online game for Android using Google App Engine in Java as the server. They seem like a perfect fit. Android requires a Google account, and GAE uses a Google account for authentication, while being free and scalable. So before the holidays I was able to get authentication to my GAE app from my Android client using the new AccountManager API in Android 2.0. The following code allows you to access the AuthToken of the user's Google account and then use it for authentication, so that the user does not have to manually enter

How to get device email address in Delphi 10

放肆的年华 提交于 2019-11-28 00:36:36
I'm trying to get my device email address, I used Java2OP to convert AccountManager class to object pascal. However, I tried to get the email address using the following code: jAm: JAccountManager; accounts: TJavaObjectArray<JAccountClass>; jAcc: JAccountClass; begin jAM := TJAccountManager.JavaClass.get(SharedActivityContext); accounts := TJavaObjectArray<JAccountClass>.Wrap(jAM.getAccountsByType(StringToJString('com.google'))); mmLog.Lines.Add('Length Accounts: ' + Inttostr(accounts.Length)); if accounts.Length > 0 then begin jAcc := accounts.Items[0]; mmLog.Lines.Add(jstringtostring( jAcc

AccountManager without a SyncAdapter?

爷,独闯天下 提交于 2019-11-28 00:21:15
问题 I'm trying to use AccountManager to store account information and have implemented an authenticator, but I keep getting exceptions like the below that crash the phone. Comparing with sample code this seems to be because I don't have (or particularly want) a SyncAdapter and associated service. Is there a trick to using AccountManager without adding a SyncAdapter? Regards Phil I/AuthenticatorActivity( 8526): onAuthenticationResult(true) I/AuthenticatorActivity( 8526): finishLogin() W/dalvikvm(

Like video with access token on YouTube using YouTube Data API v3?

Deadly 提交于 2019-11-27 23:07:15
问题 I want to like video of YouTube. I have acquired AUTH_TOKEN using AccountManager using the following am.getAuthToken(mAccount, AUTH_TOKEN_TYPE, null, this, new AccountManagerCallback<Bundle>() { public void run(AccountManagerFuture<Bundle> future) { try { if(future != null && future.getResult() != null) { if(future.getResult().containsKey(AccountManager.KEY_AUTHTOKEN)) { AUTH_TOKEN = future.getResult().getString(AccountManager.KEY_AUTHTOKEN); } } } catch(OperationCanceledException e) { }

How to call parent activity function from ASyncTask?

梦想与她 提交于 2019-11-27 20:36:40
setAccountAuthenticatorResult can be called from the Activity, which extends AccountAuthenticatorActivity . My activity extends that, but launches ASyncTask and hence this setAccountAuthenticatorResult should be called from ASyncTask (or, the result of ASyncTask should be passed back to the main thread). How to do it? What is wrong in the code below? AsyncTask<Uri, Void, Bundle> task = new RetrieveAccessTokenTask(this, consumer, provider, prefs).execute(uri); public class RetrieveAccessTokenTask extends AsyncTask<Uri, Void, Bundle> { private Context context; public RetrieveAccessTokenTask

Access youtube account with accountmanager

杀马特。学长 韩版系。学妹 提交于 2019-11-27 14:15:58
问题 Im trying to access youtube account with account manager, meaning i want to access youtube with a account linked to my device and with this get youtube token to access user playlist and whatever. Freedi application for android doing somthing like this. I used this code to get token am.getAuthToken(accounts[0], "youtube", true, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle bundle = future.getResult(); if (bundle.containsKey

How do you force AccountManager to show the “Access Request” screen after a user has already allowed access?

*爱你&永不变心* 提交于 2019-11-27 13:39:58
When using AccountManager::getAuthTokenByFeatures , an Access Request screen is shown for the user to allow or deny access to the account. After a user allows access, subsequent calls (with the same arguments) return the auth token without prompting the user. How do you clear the state to make sure the Access Request prompt appears? (This would useful at the very least for development, testing, and demo purposes.) The only solution I've found is to manually clear out the data stored in the system's accounts.db. Run the following from the command line to clear out all account grants on the