aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Google maps current location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Google maps current location" Watch "Google maps current location" New topic
Author

Google maps current location

Louise Hill
Greenhorn

Joined: Apr 26, 2014
Posts: 1
Hello,

I'm attempting to develop a basic app on XDK (cross platform) and all I want it to do for now is find the current user's location on the map. I'm using the basis of a map which currently is hard coded to locate to Sydney. I have tried different things such as declaring lat as position.coords.latitude and the same for longitude but any time i place them in instead of hard coding, no map even prints to the screen. Find my code below. Any help would be much appreciated.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

From what I can see from the documentation at getCurrentPosition Method, you have to pass a function which accepts a parameter to the method. The parameter, naturally enough, represents the current location. Your "initialize" method doesn't do that, and therefore you can't write code which uses that location parameter.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

And welcome to the Ranch!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

To find the user's current location, you'll need to use the geolocation API.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Google maps current location