> ## 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-TW/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 裝置識別碼。在此情況下，PlayFab 帳戶不會與任何電子郵件或使用者名稱相關聯。否則，如果沒有任何 PlayFab 帳戶連結至該 Android 裝置，將會傳回指出此情況的錯誤，讓遊戲可以引導使用者建立 PlayFab 帳戶。請注意，雖然可將多部此類型的裝置連結至單一使用者帳戶，但使用者的帳戶資訊中只會反映最近一次用於登入 (或最近一次連結) 的裝置。我們將在未來的版本中更新為顯示所有已連結的裝置。非同步工作完成時，請呼叫 [PFAuthenticationServerLoginWithAndroidDeviceIDGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresult) 以取得結果。

## 需求

**標頭：** PFAuthentication.h

## 另請參閱

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


## Related topics

- [PFAuthenticationServerLoginWithAndroidDeviceIDGetResultSize](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresultsize.md)
- [PFAuthenticationServerLoginWithAndroidDeviceIDGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithandroiddeviceidgetresult.md)
- [服務 C API 概觀 - PFAuthentication.h](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationServerLoginWithAndroidDeviceIDRequest](/zh-TW/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationserverloginwithandroiddeviceidrequest.md)
- [PFAuthenticationServerLoginWithIOSDeviceIDAsync](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithiosdeviceidasync.md)
