To participate, please log in to your Andromo App Maker account then come back here!

Displaying current latitude and longitude positions.

Not sure if this is the right place to put this or not but here goes.

I am trying to pull the current latitude and longitude position to put into a variable and use it to get directions to other predetermined positions on a map that will be used in a drop down.  Currently I am just working on the first part.  I know how to do the second.  However when I use the HTML archive with my code nothing displays.  Any help would be awesome!  Code is below.

Thanks!  
Char

        <script type="application/x-javascript">
            function onPositionUpdate(position)
            {
                var lat = position.coords.latitude;
                var lng = position.coords.longitude;
                alert("Current position: " + lat + " " + lng);
            }
 
            if(navigator.geolocation)
                navigator.geolocation.getCurrentPosition(onPositionUpdate);
            else
                alert("navigator.geolocation is not available");
        </script>

Comments

  • edited January 2012
    Also I have tried document.write and yes this is actually in an html page.  I even tried using the website activity and linked it to: 
    http://www.merlin.freewebsitehosting.com/.  Where it works the way it should.  However I still only get a blank page on my phone.

    Anyone?
  • It even works through the browser on my phone.  Just not through the app andromo is making.

    Char
  • I believe the problem you are seeing is due to the fact that getting the user location from inside an app requires additional permission flags to be compiled into it. These are the permissions shown when installing the app allowing the user to decide whether or not they want to allow it. These permissions are added in the Map activity (if you chose to include the location-aware option). There currently isn't any way to add custom permissions to an app.

    Darryl

  • edited January 2012
    Ah ok.  In order to accomplish what Im trying to do with my app. I need to know their latitude and longitude.  Then it takes that information and asks them where they want to go.  Putting the two together in a URL so that the directions come up right away on google maps.  I know of a work around and can use that for now, but is there any way to do that within Andromo that I am missing?  Or will this functionality become available at a later date?
  • Does it work if you add a 'Map Activity' to your project and enable the 'location' features? That would help narrow things down - and see if Darryl's suggestion would work...
  • edited January 2012
    Yes that works fine.  However what Im trying to do is go to google maps with two sets of latitudes and longitudes to show directions on the map already drawn without using the location-aware option.  

    I have found the LocationManager which allows me to set permissions to: ACCESS_FINE_LOCATION

    However I have NO clue how implement it into here.

    I can achieve this whole thing by using two drop down boxes, but that requires 
    A:) an extra step for the end user
    B:) The user to know what building they are near by

    Which most people would agree is redundant if I can use the GPS on my phone.
Sign In or Register to comment.