You can get the players country using a AccountDetailsRequest
In cloud code this will be
var accountDetailsRequest = new SparkRequests.AccountDetailsRequest; var response = Spark.sendRequestAs(accountDetailsRequest, playerId);
This will return the location json
var location = response.location;
To get the country
var country = location.country
The documentation on Account details request can be found here
Thanks
Katie
1 person likes this
T
Todd Gillissie
said
about 4 years ago
Is there a way to get the player's country code from WITHIN the AccountDetailsResponse cloud code? It seems like the data that's in the response should be available for this code to read.
ahmed mohi
Hi ,
we are working on implementing leaderboard but we need to also show the country next to each player.
I look through the documentation but didn't know how to get the country for a player.
Thanks
Hi Ahmed
Sorry for the late reply.
You can get the players country using a AccountDetailsRequest
In cloud code this will be
var accountDetailsRequest = new SparkRequests.AccountDetailsRequest;
var response = Spark.sendRequestAs(accountDetailsRequest, playerId);
This will return the location json
var location = response.location;
To get the country
var country = location.country
The documentation on Account details request can be found here
Thanks
Katie
- Oldest First
- Popular
- Newest First
Sorted by PopularCustomer Support
Hi Ahmed
Sorry for the late reply.
You can get the players country using a AccountDetailsRequest
In cloud code this will be
var accountDetailsRequest = new SparkRequests.AccountDetailsRequest;
var response = Spark.sendRequestAs(accountDetailsRequest, playerId);
This will return the location json
var location = response.location;
To get the country
var country = location.country
The documentation on Account details request can be found here
Thanks
Katie
1 person likes this
Todd Gillissie
Is there a way to get the player's country code from WITHIN the AccountDetailsResponse cloud code? It seems like the data that's in the response should be available for this code to read.
Todd Gillissie
Nevermind my last question. I found the answer:
Spark.getData();
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics