com.baidu.sapi2
类 YiAccountUtils

java.lang.Object
  继承者 com.baidu.sapi2.YiAccountUtils

public class YiAccountUtils
extends Object

This class is a wrapper of AccountManager and is meant to be used to query the account data.


嵌套类摘要
static interface YiAccountUtils.BaiduAccountCallback
           
 
字段摘要
static String BAIDUACCOUNT_ACTION
           
static String BAIDUACCOUNT_KEY
           
static String BAIDUACCOUNT_TYPE
           
 
构造方法摘要
YiAccountUtils(android.content.Context context)
           
 
方法摘要
 String blockingGetBaiduAuthToken(boolean notifyAuthFailure)
           
static YiAccountUtils getInstance(android.content.Context context)
           
 int getNumOfAccounts(String accountType)
          Return the number of the existing accounts for an account type
 void getTokenAsync(String accountType, ITokenCallback tcallback, android.app.Activity activity)
          Get the token in async mode.
 String getUserData(String key)
           
 boolean hasYiAccount()
          Query if the baidu account exists
 void invalidateToken(String accountType, String token)
          Invalidate the token in cache.
 boolean isLogin()
           
 void manageAccount()
          Launch the account management UI
 void removeAccount()
           
 void setAccount(String accountType)
          Launch the account setting UI if there is only one account added for a certain account type.
 void startFillNameActivity(android.app.Activity activity, int requestCode, boolean showDialog)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

BAIDUACCOUNT_TYPE

public static final String BAIDUACCOUNT_TYPE
另请参见:
常量字段值

BAIDUACCOUNT_ACTION

public static final String BAIDUACCOUNT_ACTION
另请参见:
常量字段值

BAIDUACCOUNT_KEY

public static final String BAIDUACCOUNT_KEY
另请参见:
常量字段值
构造方法详细信息

YiAccountUtils

public YiAccountUtils(android.content.Context context)
方法详细信息

getInstance

public static YiAccountUtils getInstance(android.content.Context context)

hasYiAccount

public boolean hasYiAccount()
Query if the baidu account exists

返回:
whether the baidu accout exists

invalidateToken

public void invalidateToken(String accountType,
                            String token)
Invalidate the token in cache. If the token is not workable any longer, app shall invalidate the copy in cache and acquire a new one by getToken(accountType);

参数:
accountType -
token -

getTokenAsync

public void getTokenAsync(String accountType,
                          ITokenCallback tcallback,
                          android.app.Activity activity)
Get the token in async mode. An intent will be broadcasted out: Action:AccountProxy.BAIDUACCOUNT_ACTION. The token shall be obtained by intent.getExtras.getString(AccountProxy.BAIDUACCOUNT_KEY).

参数:
accountType - the account type
tcallback - : the callback to receive the token. It is invoked in a separated thread.

setAccount

public void setAccount(String accountType)
Launch the account setting UI if there is only one account added for a certain account type. Otherwise it will launch the account list setting UI.

参数:
accountType - by default it is "com.baidu"

getNumOfAccounts

public int getNumOfAccounts(String accountType)
Return the number of the existing accounts for an account type

参数:
accountType - "com.baidu" by default
返回:
the number of the existing accounts

getUserData

public String getUserData(String key)

startFillNameActivity

public void startFillNameActivity(android.app.Activity activity,
                                  int requestCode,
                                  boolean showDialog)
                           throws android.content.ActivityNotFoundException
抛出:
android.content.ActivityNotFoundException

blockingGetBaiduAuthToken

public String blockingGetBaiduAuthToken(boolean notifyAuthFailure)

isLogin

public boolean isLogin()

manageAccount

public void manageAccount()
Launch the account management UI


removeAccount

public void removeAccount()


Copyright © 2013. All Rights Reserved.