Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm new to Worklight and Javascript also.but i want to get the nearby places like Restaurants,Shopping malls etc.I've searched google for solution but didn't get related info.So posting a question over here.Hope anybody helps me.


I just want a basic tutorial how to use google places api in javascript to get the nearby places



I got half way down as i know how to pass latitude and longitude values to google places but im unable to get output in worklight server
Posted
Updated 21-Jan-14 0:59am
v2

1 solution

Here you go[^]. Complete with quite a few examples that should help you get started.
 
Share this answer
 
Comments
Member 10526168 16-Jan-14 2:16am    
Thanks for quick reply Pete O'Hanlon.Ive tried it,but i have a problem.
i have a listview with categories like Restaurants,Shopping malls etc,and when i click on Restaurants the text should be directly given to google places search,so that it displays Restaurants around me.I know this is basic question but i'm new to it
Pete O'Hanlon 16-Jan-14 2:29am    
There's an example here: https://developers.google.com/maps/documentation/javascript/places#place_search_requests that shows you exactly how to do this. You need to supply your current lat/long to it, the radius of the search and the type you're interested in from the listview.
Member 10526168 16-Jan-14 3:00am    
Actually my question is it should automatically detect my location and supply lat/long coordinates to google places search
Pete O'Hanlon 16-Jan-14 3:05am    
You would use navigator.geolocation.getCurrentPosition to get your current position. The docs for this are here: http://www.w3schools.com/html/html5_geolocation.asp
Member 10526168 17-Jan-14 10:11am    
thanks for reply it helped me to get the coordinates of user but when i passed them to google places, im not getting any output

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900