| CLASS info |
| public class AuthHuaweiId implements Parcelable |
| 登录的华为帐号信息,包含id、显示名称、头像url、权限、AccessToken等信息。 |
| Type | Name | Desc |
| Creator<AuthHuaweiId> | CREATOR | AuthHuaweiId Creator。 |
| Constructor name |
| AuthHuaweiId() 默认的构造方法。 |
| Return type | Method name |
| AuthHuaweiId | createDefault() 构造一个AuthHuaweiId空对象,其属性值都为空。 |
| 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对象。 |
| String | getAccessToken() 返回用户的AccessToken。 |
| Account | getHuaweiAccount() 从华为帐号信息中获取Account。 |
| String | getDisplayName() 从华为帐号信息中获取昵称。 |
| String | getEmail() 从华为帐号信息中获取email。 |
| String | getFamilyName() 从华为帐号信息中获取FamilyName。 |
| String | getGivenName() 从华为帐号信息中获取GivenName。 |
| Set<Scope> | getAuthorizedScopes() 从华为帐号信息中获取已经授权的Scope。 |
| String | getIdToken() 从华为帐号信息中获取idToken。 |
| Uri | getAvatarUri() 从华为帐号信息中获取头像Uri。 |
| String | getAuthorizationCode() 从华为帐号信息中获取authorizationCode。 |
| String | getUnionId() 从华为帐号信息中获取unionId。unionId是开发者帐号ID,对于同一个用户,同一个开发者帐号下管理的不同应用,unionId值相同。如果一个应用转移到另外一个帐号后,unionId值也会变化。 |
| String | getOpenId() 从华为帐号信息中获取openId。同一个用户,不同应用,OpenId值不同。使用OpenId标识用户,多个应用之间同一个华为帐号用户在开发者系统内会被标识为多个用户。 |
| Constructor name | |
| int | describeContents() 重写describeContents()方法。 |
| void | writeToParcel(Parcel dest, int flags) 重写writeToParcel方法。 |
| constructor |
| AuthHuaweiId() |
| 默认的构造方法。 |
| constructor |
| Method |
| public static AuthHuaweiId createDefault() |
| 构造一个AuthHuaweiId空对象,其属性值都为空。 |
Return
| type | desc |
| 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 name | Parameter desc |
| openId | openId。 |
| uid | 用户Id。 |
| displayName | 昵称。 |
| photoUrl | 头像uri。 |
| accessToken | 用户的AccessToken。 |
| serviceCountryCode | 帐号所属服务地代码。 |
| status | 用户的有效状态。1:正常;2:Dbank暂停;3:已销户;4:全业务暂停。 |
| gender | 用户性别。-1:未知,0:男性,1:女性,2:保密。 |
| scopes | 已授权的Scopes。 |
| serverAuthCode | serverAuthCode。 |
| unionId | unionId。 |
| countryCode | 帐号所属注册地代码。 |
Return
| type | desc |
| AuthHuaweiId | AuthHuaweiId对象。 |
| Method |
| public String getAccessToken() |
| 从华为帐号信息中获取Access Token。 |
Return
| type | desc |
| String | Access Token。 |
| Method |
| public Account getHuaweiAccount() |
| 使用email生成android.accounts.Account对象,email由getEmail()获取。 |
Return
| type | desc |
| android.accounts.Account | Account对象。 |
| type | desc |
| Method |
| public String getDisplayName() |
| 如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的华为帐号昵称,否则返回null。 |
Return
| type | desc |
| String | 昵称。 |
| Method |
| public String getEmail() |
| 如果授权时携带new HuaweiIdAuthParamsHelper().setEmail()指定的授权参数,该方法返回授权用户的email地址,否则返回null。 |
Return
| type | desc |
| String | 帐号的Email地址。 |
| Method |
| public String getFamilyName() |
| 如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的FamilyName,否则返回null。 |
Return
| type | desc |
| String | 帐号的FamilyName。 |
| Method |
| public String getGivenName() |
| 如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的GivenName,否则返回null。 |
Return
| type | desc |
| String | 帐号的GivenName。 |
| type | desc |
| Method |
| public String getAuthorizedScopes() |
| 返回华为帐号用户授权给当前应用的所有Scope。 |
Return
| type | desc |
| String | 返回华为帐号用户授权给当前应用的所有Scope。 |
| type | desc |
| Method |
| public String getIdToken() |
| 如果授权时携带new HuaweiIdAuthParamsHelper.setIdToken()指定的授权参数,该方法返回授权用户的ID token,否则返回null。 |
Return
| type | desc |
| String | 返回授权用户的ID token。 |
| Method |
| public String getAvatarUri() |
| 如果授权时携带new HuaweiIdAuthParamsHelper(HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM)或者setProfile()指定的授权参数,该方法返回授权用户的头像的URI地址,否则返回null。 |
Return
| type | desc |
| String | 返回授权用户的头像的URI地址。 |
| Method |
| public String getAuthorizationCode() |
| 该方法返回用户的Authorization Code,否则返回null。应用可以使用Authorization Code从华为帐号服务器获取Access Token。 |
Return
| type | desc |
| 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
| type | desc |
| String | 获取用户的unionId。 |
| Method |
| public String getOpenId() |
| 如果授权时携带new HuaweiIdAuthParamsHelper().setId()指定的授权参数,该方法返回openId,否则返回null。同一个用户,不同应用,OpenId值不同。使用OpenId标识用户,多个应用之间同一个华为帐号用户在开发者系统内会被标识为多个用户。 |
Return
| type | desc |
| String | 获取用户的openId。 |
| type | desc |
| type | desc |