Hi,
I'm sending push notifications with Azure Functions, it all works as expected. But now I'm implementing a multi-language option. But for some reason I can't get the player's language in Azure Function?
Anybody to help?
Hi,
I'm sending push notifications with Azure Functions, it all works as expected. But now I'm implementing a multi-language option. But for some reason I can't get the player's language in Azure Function?
Anybody to help?
To retrieve the player’s language code, you can call the Entity API GetProfile. You can find the language code in the response’s Profile.Language field. For more information about this API, please read the API reference (https://docs.microsoft.com/rest/api/playfab/profiles/account-management/getprofile) of it.
Besides, you can also try to look for this field in the function's context. Typically, when a function is executed by players entities, the players' Entity Profiles would be passed to context parameters. Please refer to this documentation (https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript-af/cloudscript-af-context) for more details of Azure Functions' contexts.
If you have called the Entity Profiles in Azure Functions and encounter some problems when using it. Please provide more issue details, such as error messages, for our analysis.
Thanks for the answer. I've found the solution indeed.
var profilesApi = new PlayFabProfilesInstanceAPI(apiSettings, authenticationContext); PlayFabResult<GetEntityProfileResponse> profileResponse = await profilesApi.GetProfileAsync(entityProfileRequest); if (profileResponse.Result.Profile.Language != String.Empty) { playerLanguage = profileResponse.Result.Profile.Language; log.LogInformation($"Player profile language : {playerLanguage}"); }
2 People are following this question.