accountmanager

Adding account through Account manager

烈酒焚心 提交于 2019-12-03 03:08:07
I'm new to android development so sorry if im asking a really obvious question.For my app I want to add a google account automatically using account manager. Do I want to use addAccount or addAccountExplicitly and how do i go about this assuming the account name was "platinum" and the password is "software". try this : Permission required : <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/></uses-permission> <uses-permission android:name="android.permission.ACCOUNT_MANAGER"></uses-permission> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission>

How do we control an Android sync adapter preference?

穿精又带淫゛_ 提交于 2019-12-03 00:29:43
In an attempt to write a custom Android sync adapter I followed this . I was success at showing an entry (Account settings) in General setting with the following code snippet from above said example. <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="General Settings" /> <PreferenceScreen android:key="account_settings" android:title="Account Settings" android:summary="Sync frequency, notifications, etc."> <intent android:action="fm.last.android.activity.Preferences.ACCOUNT_SETUP" android:targetPackage="fm.last.android" android

SyncAdapter Without an Account

我与影子孤独终老i 提交于 2019-12-03 00:23:25
I'm trying to create a SyncAdapter for my Android app to show YouTube videos from one specific channel. The videos are public domain so I don't want the user to login, create an account, authenticate themselves, upload data, or use the contacts database. I simply want the SyncAdapter to periodically update my app's database with the newest video metadata from that channel. I already built a ContentProvider to access my database. I do like the fact that the SyncProvider will handle the ability to turn off syncing, scheduling, and retry backoff mechanisms for updating. I asked earlier if a

Can I use AccountManager to let users sign in with their Google account?

坚强是说给别人听的谎言 提交于 2019-12-02 22:03:26
I'm creating an app that will need users to create an account. (Like Facebook or Twitter would require you to.) BUT, since it's an Android app, should/can I let them sign in with their Google Account using AccountManager or some other service? It'd be very helpful if they could just sign in to their Google account and their settings and other options would be saved to that account. Main questions summed up: Is it possible to let a user just use their Google account in my app? If so, do I use AccountManager to have them sign in and save account information/settings? What are other options? Yes,

Shouldn't Android AccountManager Store OAuth Tokens on a Per-App/UID Basis?

别来无恙 提交于 2019-12-02 15:39:38
Android's AccountManager appears to fetch the same cached auth token for apps with different UIDs - is this secure? It does not seem compatible with OAuth2, since access tokens are not supposed to be shared between different clients. Background/Context I am building an Android app which uses OAuth2 for authentication/authorization of REST API requests to my server, which is an OAuth2 provider. Since the app is the "official" app (as opposed to a 3rd-party app), it is considered a trusted OAuth2 client, so I am using the resource owner password flow for obtaining an OAuth2 token: the user (the

Can't get default account in OREO

本秂侑毒 提交于 2019-12-02 01:19:00
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. As per Android's update, from Oreo onwards we can not use AccountManager.getAccountsByType to get the list of google accounts configured on user's device, as they have updated the Google SignIn

AccountManager: How to let the user select an Account using a Dialog

∥☆過路亽.° 提交于 2019-12-01 23:16:07
In the AccountManager tutorial Remembering Your User , it's recommended: If there's more than one Account in the array, you should present a dialog asking the user to select one. What's the best way to do this? I have a solution in mind, but if there are other good examples from the community, it seems like this is the kind of boilerplate code that could be shared and easily re-used by others. Priyanka Eratkar From Android 4.0 (API level 14) onwards, launching an activity with an intent shown below, shows account chooser. Intent intent = AccountManager.newChooseAccountIntent(null, null, new

AccountManager: invalidateAuthToken does not invalidate the token

旧城冷巷雨未停 提交于 2019-12-01 22:29:43
问题 I'm trying to get a brand new token from a Google account stored in a Android device but all that I got is the same old token that I've been caching in the last days. It seems that it's cached somewhere in the phone, and even the Internet request is not being sent (I made the test in the app without Internet connection and the same token is returned). I used the invalidateAuthToken method before getting a new one with getResult from AccountManagerFuture . Take a look please: public String

AccountManager: How to let the user select an Account using a Dialog

跟風遠走 提交于 2019-12-01 21:49:58
问题 In the AccountManager tutorial Remembering Your User, it's recommended: If there's more than one Account in the array, you should present a dialog asking the user to select one. What's the best way to do this? I have a solution in mind, but if there are other good examples from the community, it seems like this is the kind of boilerplate code that could be shared and easily re-used by others. 回答1: From Android 4.0 (API level 14) onwards, launching an activity with an intent shown below, shows

AccountManager: invalidateAuthToken does not invalidate the token

戏子无情 提交于 2019-12-01 21:20:16
I'm trying to get a brand new token from a Google account stored in a Android device but all that I got is the same old token that I've been caching in the last days. It seems that it's cached somewhere in the phone, and even the Internet request is not being sent (I made the test in the app without Internet connection and the same token is returned). I used the invalidateAuthToken method before getting a new one with getResult from AccountManagerFuture . Take a look please: public String updateToken(Activity activity) throws Exception { AccountManager am = AccountManager.get(activity);