function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RamsRams 

How to the current location through webservices

Hi,

 

Is there any possibility to get the navigator current location using web services or apex class... Please help me if any way.. Thanks in advance.

 

Thanks.

Rams

Bhawani SharmaBhawani Sharma
You can use ApexPage.currentPage().getUrl() method.
RamsRams

Hi,

 

If i use that, i am able get the url only.. How can i use for getting current address. pls help me.. if have sample code. provide me.. Thanks in advance. 

 

Thanks,

Rams

Bhawani SharmaBhawani Sharma

What you mean by current address? Trying to understand.

RamsRams

Hi,

 

Yes.. current address.... If user is in hyderabad, it needs to show the hyderabad address..

 

Thanks,

Rams

sfdcfoxsfdcfox
You would use a geolocation service for this. Most geolocation APIs can be accurate to the nearest major city, since it goes off a grand database of where IP addresses have been allocated to. You'll need to subscribe to such a service, then read up on performing REST calls to that service.
RamsRams

Hi,

 

Thanks for your reply. Do you have any reference urls or code. If you have please provide me. Thanks in advance.

 

Thanks,

RAms

sfdcfoxsfdcfox
http://www.google.com/search?q=geolocation+ip

Just pick a service. They mostly offer similar services, although most require an account and provide a number of uses per day. Google, for example, allows you to use their APIs with an enterprise account and an API key.

I haven't extensively used these services, so I would suggest you take a look for yourself and see what's out there.