> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFAuthenticationServerLoginWithAndroidDeviceIDAsync

> 使用 Android 设备标识符为用户登录，并返回会话标识符，该标识符随后可用于需要经过身份验证的用户的 API 调用

使用 Android 设备标识符为用户登录，并返回会话标识符，该标识符随后可用于需要经过身份验证的用户的 API 调用

## 语法

```cpp theme={null}
HRESULT PFAuthenticationServerLoginWithAndroidDeviceIDAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const char* secretKey,  
    const PFAuthenticationServerLoginWithAndroidDeviceIDRequest* request,  
    XAsyncBlock* async  
)  
```

### 参数

**`serviceConfigHandle`**   PFServiceConfigHandle

从 PFServiceConfigCreateHandle 调用返回的 PFServiceConfigHandle。

**`secretKey`**   char\*<br />*In\_z*

用于对服务请求进行身份验证的游戏密钥。

**`request`**   [PFAuthenticationServerLoginWithAndroidDeviceIDRequest\*](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationserverloginwithandroiddeviceidrequest)

已填充的请求对象。

**`async`**   XAsyncBlock\*<br />*Inout*

用于异步操作的 XAsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的结果代码。

## 备注

此 API 可在 Windows 上使用。在 Android 设备上，建议使用 Settings.Secure.ANDROID\_ID 作为 AndroidDeviceId，如此博客文章 ([http://android-developers.blogspot.com/2011/03/identifying-app-installations.html](http://android-developers.blogspot.com/2011/03/identifying-app-installations.html)) 中所述。有关此标识符的详细信息，请参阅 Android 文档 ([http://developer.android.com/reference/android/provider/Settings.Secure.html](http://developer.android.com/reference/android/provider/Settings.Secure.html))。如果这是用户首次使用该 Android 设备登录，并且 CreateAccount 设置为 true，则会创建一个新的 PlayFab 账户并将其关联到该 Android 设备 ID。在这种情况下，不会有电子邮件或用户名与该 PlayFab 账户关联。否则，如果没有 PlayFab 账户关联到该 Android 设备，将返回指示此情况的错误，以便游戏可以引导用户创建 PlayFab 账户。请注意，虽然可以将多个此类设备关联到单个用户账户，但只有最近用于登录（或最近关联）的设备才会反映在用户的账户信息中。我们将在未来的版本中进行更新，以显示所有已关联的设备。异步任务完成后，调用 [PFAuthenticationServerLoginWithAndroidDeviceIDGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresult) 获取结果。

## 要求

**头文件：** PFAuthentication.h

## 另请参阅

[PFAuthentication 成员](/zh-CN/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [PFAuthenticationServerLoginWithAndroidDeviceIDGetResultSize](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresultsize.md)
- [PFAuthenticationServerLoginWithAndroidDeviceIDGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresult.md)
- [PFAuthenticationServerLoginWithAndroidDeviceIDRequest](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationserverloginwithandroiddeviceidrequest.md)
- [PFAuthenticationServerLoginWithIOSDeviceIDAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithiosdeviceidasync.md)
- [PFAuthenticationServerLoginWithIOSDeviceIDGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithiosdeviceidgetresult.md)
