Geo Location

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

noveltysoft
Posts: 39
Joined: 19 Sep 2012, 03:24

Geo Location

Postby noveltysoft » 10 Jun 2013, 01:15

Hi, is there any way I can capture Geo Location using API? I saw the Admin portal shows the Geo location. But I need to show it in User's Profile in my Game. Is there any way I can get the Geo Location from SFS API? If yes, then please let me know the details.

Thanks,
William
User avatar
Lapo
Site Admin
Posts: 21993
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Geo Location

Postby Lapo » 10 Jun 2013, 10:25

We have recently included geolocation services for our Analytics product.
So yes, it might be possible in the future to use that as well for other users at runtime, we will think about it.

At the moment the best way to implement it is to ask or auto-detect the country at registration time and store it in the user's database.
When the user is logged in the system you can add his country name or image-url to the user's variables.

In general the detection at sign up time is better than running a runtime check every time.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
foxboy
Posts: 110
Joined: 12 May 2011, 02:47
Location: Optimal Solution Pte. Ltd.

Re: Geo Location

Postby foxboy » 19 Sep 2016, 06:56

Hi Lapo,

Is GeoLocation available now on the new SFS version (2.11)?

I need a way to get the user's Country Code based on the user' IP upon initial login, then I want to store in on the database for next login.
"Dream it, I'll code it..."
Lead Developer
Optimal Solution Pte. Ltd.
User avatar
Lapo
Site Admin
Posts: 21993
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Geo Location

Postby Lapo » 19 Sep 2016, 09:04

Hi,
officially no, but there's a way to access the analytics geolocation API. I am going to write a brief "recipe" in our blog and post the link here later.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 21993
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Geo Location

Postby Lapo » 19 Sep 2016, 09:33

Here it is the recipe for geolocation:
http://smartfoxserver.com/blog/using-th ... ation-api/

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
foxboy
Posts: 110
Joined: 12 May 2011, 02:47
Location: Optimal Solution Pte. Ltd.

Re: Geo Location

Postby foxboy » 19 Sep 2016, 09:57

Thanks Lapo. This is awesome!

Just some questions though:

1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers? If so, do I need to update that data file by downloading latest version from Maxmind?

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?
"Dream it, I'll code it..."
Lead Developer
Optimal Solution Pte. Ltd.
User avatar
Lapo
Site Admin
Posts: 21993
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Geo Location

Postby Lapo » 19 Sep 2016, 10:46

foxboy wrote:1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers?

We use the local DB, not HTTP calls as it would be too slow.

If so, do I need to update that data file by downloading latest version from Maxmind?

This is a little tricky. Normally yes, but there's a caveat:
SFS2X 2.11.x still uses what they refer to as the "legacy" version --> http://dev.maxmind.com/geoip/legacy/geolite/

This is because recently they have introduced a new version of the geolocation service which we'll integrate in the next 2.12

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?[/quote]
Yes, absolutely.
Lapo

--

gotoAndPlay()

...addicted to flash games
ArnouSolitary
Posts: 1
Joined: 23 Apr 2021, 11:43

Re: Geo Location

Postby ArnouSolitary » 23 Apr 2021, 11:50

Lapo wrote:
foxboy wrote:1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers?

We use the local DB, not HTTP calls as it would be too slow.

If so, do I need to update that data file by downloading latest version from Maxmind?

This is a little tricky. Normally yes, but there's a caveat:
SFS2X 2.11.x still uses what they refer to as the "legacy" version --> http://dev.maxmind.com/geoip/legacy/geolite/

This is because recently they have introduced a new version of the geolocation service which we'll integrate in the next 2.12

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?

How can i access user's city , region , longitude and latitude? [/quote]
User avatar
Lapo
Site Admin
Posts: 21993
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Geo Location

Postby Lapo » 23 Apr 2021, 14:52

Hi,
the geo location database we include in SFS2X only provides the country (code and name). For extra details such as the city name or coordinates you may need to look into a dedicated service.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: Google [Bot] and 8 guests