question

FW avatar image
FW asked

Country Data

Hi

In the Account Summary data of each player I can see the "Country" field.

What is the way to access this data with the Client Api?

Thanks.-

Player Datadata
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Not currently, though we will be providing more functionality for exposing/accessing profile data in future updates. But you could expose the player's current location right now via a Public (readable by others) User Data value in the player account. What is the intended use case, though? Knowing that might help to provide a better solution.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

FW avatar image FW commented ·

I just want to show in my game, in the player's profile, the name of his country. From now, I could save the "Country" data in the public data of the user, but as I do with players who are already registered in PlayFab? As I see you keep that data, it would be great to be able to read it with the Client Api Thanks.-

0 Likes 0 ·
brendan avatar image brendan FW commented ·

The Location info is in the PlayStream login event, so you can get it every time the player logs in by setting up a Rule that triggers a Cloud Script to read that info from the login event.

0 Likes 0 ·
sathyaraj avatar image sathyaraj commented ·

Hi, @Brendan

I am trying to build a key value map to show the country flags. Can you please share the country names as they are stored in playfab. It will be easy and accurate this way.

0 Likes 0 ·
brendan avatar image brendan sathyaraj commented ·

The country codes are listed in the PlayStream event documentation, here: https://api.playfab.com/playstream/events/datatype/CountryCode

-1 Like -1 ·
Brent Batas (Lisk) avatar image
Brent Batas (Lisk) answered

To anyone still following along, you can use something like

https://stackoverflow.com/questions/34765235/how-to-map-a-two-letter-iso-3166-country-code-to-a-culture-in-c-sharp to get the CultureInfo, then use that to create a RegionInfo (pass it cultureInfo.Name). Then use the regionInfo.EnglishName to get the country name.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.