1 Reply Latest reply on Jan 20, 2013 1:41 PM by Darryn Campbell

    Geolocation support in RhoElements?

    Dan McCabe

      This is the standard way to get geolocation in html on ios,android, windows phone, etc.

       

            if (navigator.geolocation) { 
                 var updateLocation = navigator.geolocation.watchPosition(geosuccess, geofail);
            }


           function geosuccess(position){

                 glat = position.coords.latitude;
                 glon = position.coords.longitude;
            }

            function geofail(){
                 glat = "";
                 glon = "";
            }

       

      Assume I'd like to install RhoElements on an MC65 and point it at a web page that does the above for iphones.


      Will this work?

       

      The documentation here http://docs.rhomobile.com/rhodes/device-caps#geolocation implies that the answer is "no"

       

      I can't quite figure out from these docs if there is a way to do this by making an ajax call to something installed behind the webserver on the local device or not.

       

      Thx in advance,

       

      Dan

       


       


        • Re: Geolocation support in RhoElements?
          Darryn Campbell

          Hi Dan,

           

          HTML5 geolocation will work on the MC65 (though obviously the accuracy will not be enhanced by cell towers or by nearby wifi, as it would be on Android).  The geolocation API you refer to is separate from HTML5 geolocation and, whilst is supported on all platforms, I have been told there are known bugs with it on Windows which leads me to suggest you use the HTML5 geolocation API as it looks like you're already doing.

           

          Darryn.