• PUDN用户
  • Java
  • 13KB
  • rar
  • 0
  • 1 积分
  • 1
  • 2013-10-10 22:49
This class provides access to a centralized registry of the user s online accounts for Andriod.
package android.accounts; import; import android.content.Intent; import android.content.Context; import android.content.IntentFilter; import android.content.BroadcastReceiver; import android.database.SQLException; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import android.os.Parcelable; import android.os.Build; import android.util.Log; import android.text.TextUtils; import; import java.util.concurrent.Callable; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeUnit; import java.util.HashMap; import java.util.Map; import; /** * This class provides access to a centralized registry of the user's * online accounts. The user enters credentials (username and password) once * per account, granting applications access to online resources with * "one-click" approval. * * <p>Different online services have different ways of handling accounts and * authentication, so the account manager uses pluggable <em>authenticator</em> * modules for different <em>account types</em>. Authenticators (which may be * written by third parties) handle the actual details of validating account * credentials and storing account information. For example, Google, Facebook, * and Microsoft Exchange each have their own authenticator. * * <p>Many servers support some notion of an <em>authentication token</em>, * which can be used to authenticate a request to the server without sending * the user's actual password. (Auth tokens are normally created with a * separate request which does include the user's credentials.) AccountManager * can generate auth tokens for applications, so the application doesn't need to * handle passwords directly. Auth tokens are normally reusable and cached by * AccountManager, but must be refreshed periodically. It's the responsibility * of applications to <em>invalidate</em> auth tokens when they stop working so * the AccountManager knows it needs to regenerate them. * * <p>Applications accessing a server normally go through these steps: * * <ul> * <li>Get an instance of AccountManager using {@link #get(Context)}. * * <li>List the available accounts using {@link #getAccountsByType} or * {@link #getAccountsByTypeAndFeatures}. Normally applications will only * be interested in accounts with one particular <em>type</em>, which * identifies the authenticator. Account <em>features</em> are used to * identify particular account subtypes and capabilities. Both the account * type and features are authenticator-specific strings, and must be known by * the application in coordination with its preferred authenticators. * * <li>Select one or more of the available accounts, possibly by asking the * user for their preference. If no suitable accounts are available, * {@link #addAccount} may be called to prompt the user to create an * account of the appropriate type. * * <li><b>Important:</b> If the application is using a previously remembered * account selection, it must make sure the account is still in the list * of accounts returned by {@link #getAccountsByType}. Requesting an auth token * for an account no longer on the device results in an undefined failure. * * <li>Request an auth token for the selected account(s) using one of the * {@link #getAuthToken} methods or related helpers. Refer to the description * of each method for exact usage and error handling details. * * <li>Make the request using the auth token. The form of the auth token, * the format of the request, and the protocol used are all specific to the * service you are accessing. The application may use whatever network and * protocol libraries are useful. * * <li><b>Important:</b> If the request fails with an authentication error, * it could be that a cached auth token is stale and no longer honored by * the server. The application must call {@link #invalidateAuthToken} to remove * the token from the cache, otherwise requests will continue failing! After * invalidating the auth token, immediately go back to the "Request an auth * token" step above. If the process fails the second time, then it can be * treated as a "genuine" authentication failure and the user notified or other * appropriate actions taken. * </ul> * * <p>Some AccountManager methods may need to interact with the user to * prompt for credentials, present options, or ask the user to add an account. * The caller may choose whether to allow AccountManager to directly launch the * necessary user interface and wait for the user, or to return an Intent which * the caller may use to launch the interface, or (in some cases) to install a * notification which the user can select at any time to launch the interface. * To have AccountManager launch the interface directly, the caller must supply * the current foreground {@link Activity} context. * * <p>Many AccountManager methods take {@link AccountManagerCallback} and * {@link Handler} as parameters. These methods return immediately and * run asynchronously. If a callback is provided then * {@link AccountManagerCallback#run} will be invoked on the Handler's * thread when the request completes, successfully or not. * The result is retrieved by calling {@link AccountManagerFuture#getResult()} * on the {@link AccountManagerFuture} returned by the method (and also passed * to the callback). This method waits for the operation to complete (if * necessary) and either returns the result or throws an exception if an error * occurred during the operation. To make the request synchronously, call * {@link AccountManagerFuture#getResult()} immediately on receiving the * future from the method; no callback need be supplied. * * <p>Requests which may block, including * {@link AccountManagerFuture#getResult()}, must never be called on * the application's main event thread. These operations throw * {@link IllegalStateException} if they are used on the main thread. */ public class AccountManager { private static final String TAG = "AccountManager"; public static final int ERROR_CODE_REMOTE_EXCEPTION = 1; public static final int ERROR_CODE_NETWORK_ERROR = 3; public static final int ERROR_CODE_CANCELED = 4; public static final int ERROR_CODE_INVALID_RESPONSE = 5; public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6; public static final int ERROR_CODE_BAD_ARGUMENTS = 7; public static final int ERROR_CODE_BAD_REQUEST = 8; /** * Bundle key used for the {@link String} account name in results * from methods which return information about a particular account. */ public static final String KEY_ACCOUNT_NAME = "authAccount"; /** * Bundle key used for the {@link String} account type in results * from methods which return information about a particular account. */ public static final String KEY_ACCOUNT_TYPE = "accountType"; /** * Bundle key used for the auth token value in results * from {@link #getAuthToken} and friends. */ public static final String KEY_AUTHTOKEN = "authtoken"; /** * Bundle key used for an {@link Intent} in results from methods that * may require the caller to interact with the user. The Intent can * be used to start the corresponding user interface activity. */ public static final String KEY_INTENT = "intent"; /** * Bundle key used to supply the password directly in options to * {@link #confirmCredentials}, rather than prompting the user with * the standard password prompt. */ public static final String KEY_PASSWORD = "password"; public static final String KEY_ACCOUNTS = "accounts"; public static final String KEY_
    • the-individual--accounts.rar
    • intersection.rar
      Number, the center of the x / y coordinates and radius values entered by the user accounts that intersects the circle C program
      The script uses an API cPanel, for the creation of the accounts. Every account created email appears on your cPanel, and you can make actions of management above. Your visitors just have to enter ...
    • eos-accounts
      该项目是通过引导的。 您将在下面找到一些有关如何执行常见任务的信息。 您可以在找到本指南的最新版本。 目录 自动格式化代码 更改页面<title> 安装依赖项 导入组件 代码分割 添加样式表 ...met
    • stn-accounts
      STN帐户 一个用Go(lang)编写的小型REST API .../ accounts / {id} / balance 邮政 /帐户 邮政 /登录 得到 /转移 邮政 /转移 发展 本节描述了应用程序体系结构及其元素的放置方式 应用层 下图显示了
    • accounts:https
      自述 此自述文件通常会记录启动和运行应用程序所需的任何步骤。 您可能想要涵盖的内容: Ruby版 系统依赖 配置 数据库创建 数据库初始化 如何运行测试套件 服务(作业队列、缓存服务器、搜索引擎等) ...
    • accounts-assessor
      会计评估员 - 介绍 该存储库对利用逻辑编程解决会计问题进行了实际研究。 核心逻辑在 SWI-Prolog 中运行,并由 python 网络服务器提供帮助。 提供多项服务: 投资计算器 租购协议 折旧 牲畜(独立) ...
    • email_auth_accounts
      帐目 Django的自定义电子邮件身份验证 详细的文档位于“ docs”目录中。 快速开始 将“帐户”添加到您的INSTALLED_APPS设置中,如下所示: ...url(r'^accounts/', include('accounts.urls')), 运行python
    • accounts-entry
      accounts-entry是一个陨石程序包,它依赖于Iron Router,并提供了account-ui的替代接口,包括用于注册和登录的整个页面。 兼容性 目前,accounts-entry与Iron Router 1.0.0及更高版本兼容。 由于陨石不支持语义版本...
      李天平通用权限管理系统: 实现用户角色机器权限分组管理 (Li Tianping Universal Rights Management System: user role management division of the machine permissions)