You need to sign in to do that
Don't have an account?
Naveen Sana
How to get the location of logged in user using apex
Hi,
How can we achieve the region details of the logged-in user by using apex?
How can we achieve the region details of the logged-in user by using apex?
Greetings to you!
You need to use Geolocation API (https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API) or Google's GeoCoding API (https://developers.google.com/maps/documentation/geocoding/intro). Please refer to the below links which might help you further with the above requirement.
https://salesforce.stackexchange.com/questions/138429/how-to-get-current-user-geo-locationlongitude-latitude
https://developer.salesforce.com/forums/?id=9060G0000005dHlQAI
https://developer.salesforce.com/forums/?id=906F0000000A372IAC
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
You can get the current location of logged user. In this code get loaction in latitude and longitude format.
Please try the code given below.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
thanks for your reply!!
actually my requirement is to get the weather report based on the location of the logged in user on loading of aura componet.
I tried the same type of code which you have sent, but no luck !!
I am getting this output --> Unable to retrieve your location
The code you posted uses code that when run will pop up an alert to the user asking them if they will allow the browser to know their location. Is that popping up for you so that you can click "Allow"?