目录

CLASS info
public class AuthHuaweiId implements Parcelable
登录的华为帐号信息,包含id、显示名称、头像url、权限、AccessToken等信息。

Field Summary

TypeNameDesc
Creator<AuthHuaweiId>CREATORAuthHuaweiId Creator。

Public Constructor Summary

Constructor name
AuthHuaweiId()
默认的构造方法。

Public Method Summary

Return typeMethod name
AuthHuaweiIdcreateDefault()
构造一个AuthHuaweiId空对象,其属性值都为空。
AuthHuaweiIdbuild(String openId, String uid, String displayName, String photoUrl,String accessToken, String serviceCountryCode, int status, int gender, Set<Scope> scopes, String serverAuthCode, String unionId, String countryCode)
使用提供的属性构造AuthHuaweiId对象。
StringgetAccessToken()
返回用户的AccessToken。
AccountgetHuaweiAccount()
从华为帐号信息中获取Account。
StringgetDisplayName()
从华为帐号信息中获取昵称。
StringgetEmail()
从华为帐号信息中获取email。
StringgetFamilyName()
从华为帐号信息中获取FamilyName。
StringgetGivenName()
从华为帐号信息中获取GivenName。
Set<Scope>getAuthorizedScopes()
从华为帐号信息中获取已经授权的Scope。
StringgetIdToken()
从华为帐号信息中获取idToken。
UrigetAvatarUri()
从华为帐号信息中获取头像Uri。
StringgetAuthorizationCode()
从华为帐号信息中获取authorizationCode。
StringgetUnionId()
从华为帐号信息中获取unionId。unionId是开发者帐号ID,对于同一个用户,同一个开发者帐号下管理的不同应用,unionId值相同。如果一个应用转移到另外一个帐号后,unionId值也会变化。
StringgetOpenId()
从华为帐号信息中获取openId。同一个用户,不同应用,OpenId值不同。使用OpenId标识用户,多个应用之间同一个华为帐号用户在开发者系统内会被标识为多个用户。

Inherited Method Summary


Constructor name
intdescribeContents()
重写describeContents()方法。
void
writeToParcel(Parcel dest, int flags)
重写writeToParcel方法。

Public Constructors

constructor
AuthHuaweiId()
默认的构造方法。
constructor

Public Methods

Method
public static AuthHuaweiId createDefault()
构造一个AuthHuaweiId空对象,其属性值都为空。

Return

typedesc
AuthHuaweiId一个属性值都为空的AuthHuaweiId对象。
Method
public static AuthHuaweiId build(String openId, String uid, String displayName, String photoUrl, String accessToken, String serviceCountryCode, int status, int gender, Set<Scope> scopes, String serverAuthCode, String unionId, String countryCode)
使用提供的属性构造AuthHuaweiId对象。

Parameters

Parameter nameParameter desc
openIdopenId。
uid用户Id。
displayName昵称。
photoUrl头像uri。
accessToken用户的AccessToken。
serviceCountryCode帐号所属服务地代码。
status用户的有效状态。1:正常;2:Dbank暂停;3:已销户;4:全业务暂停。
gender用户性别。-1:未知,0:男性,1:女性,2:保密。
scopes已授权的Scopes。
serverAuthCodeserverAuthCode。
unionIdunionId。
countryCode帐号所属注册地代码。

Return

typedesc
AuthHuaweiIdAuthHuaweiId对象。
Method
public String getAccessToken()
从华为帐号信息中获取Access Token。

Return

typedesc
StringAccess Token。
Method
public Account getHuaweiAccount()
使用email生成android.accounts.Account对象,email由getEmail()获取。

Return

typedesc
android.accounts.AccountAccount对象。
typedesc
Method
public String getDisplayName()
如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的华为帐号昵称,否则返回null。

Return

typedesc
String昵称。
Method
public String getEmail()
如果授权时携带new HuaweiIdAuthParamsHelper().setEmail()指定的授权参数,该方法返回授权用户的email地址,否则返回null。

Return

typedesc
String帐号的Email地址。
Method
public String getFamilyName()
如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的FamilyName,否则返回null。

Return

typedesc
String帐号的FamilyName。
Method
public String getGivenName()
如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的GivenName,否则返回null。

Return

typedesc
String帐号的GivenName。
typedesc
Method
public String getAuthorizedScopes()
返回华为帐号用户授权给当前应用的所有Scope。

Return

typedesc
String返回华为帐号用户授权给当前应用的所有Scope。
typedesc
Method
public String getIdToken()
如果授权时携带new HuaweiIdAuthParamsHelper.setIdToken()指定的授权参数,该方法返回授权用户的ID token,否则返回null。

Return

typedesc
String返回授权用户的ID token。
Method
public String getAvatarUri()
如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的头像的URI地址,否则返回null。

Return

typedesc
String返回授权用户的头像的URI地址。
Method
public String getAuthorizationCode()
该方法返回用户的Authorization Code,否则返回null。应用可以使用Authorization Code从华为帐号服务器获取Access Token。

Return

typedesc
String返回用户的Authorization Code。
Method
public String getUnionId()
如果授权时携带new HuaweiIdAuthParamsHelper().setId()指定的授权参数,该方法返回用户的unionId,否则返回null。
unionId和openId的区别在于,如果开发者帐号下管理了多个应用,针对同一个华为帐号,不同的应用返回的openId值不同,但返回的unionId相同。如果开发者需要在不同应用中共享同一个华为帐号的用户信息,可以使用unionId作为用户标识。
使用unionId作为用户标识需要满足以下所有条件,如果任一不满足则不会返回:
● 应用集成HMS SDK 3.0.0以及更高版本。
● 华为移动服务APK版本为3.0.0以及更高版本。
● 应用启用了UnionId。

Return

typedesc
String获取用户的unionId。
Method
public String getOpenId()
如果授权时携带new HuaweiIdAuthParamsHelper().setId()指定的授权参数,该方法返回openId,否则返回null。同一个用户,不同应用,OpenId值不同。使用OpenId标识用户,多个应用之间同一个华为帐号用户在开发者系统内会被标识为多个用户。

Return

typedesc
String获取用户的openId。



typedesc


typedesc