6 Replies Latest reply on Jan 29, 2015 3:14 AM by Graham Downs

    GeoLocation.known_position always returns zero

    Graham Downs

      Hi, All

       

      I'm trying to get my application to record GPS coordinates on a schedule, and write them to a log file. Using the documentation found at this page, here's my code:

       

      In my AppApplication class:


      def on_activate_app

      GeoLocation.set_notification("/app/Settings/geo_callback", "", 3)

      end

       

      In my SettingsController class:


      def geo_callback

      puts "geo_callback : #{@params}"

      end

       

      Here's what's written in my log file (on an iPad Mini) every three seconds:

       

      Params: {"rho_callback"=>"1", "status"=>"ok", "available"=>"1", "known_position"=>"0", "latitude"=>"0.000000", "longitude"=>"0.000000", "accuracy"=>"0.000000"}

       

      As you can see, "known_position" is always 0, and "latitude" and "longitude" are both always "0.000000".

       

      While my app is running, I also opened the iPad Maps application, just to make sure GPS was working, and it immediately gave my exact position on the map (I was testing outdoors).

       

      I also decided to try and take and take "set_notification" and the "geo_callback" out of the equation, so I commented those out and put a button in my app that would call a controller method which queried GeoLocation.known_position and GeoLocation.latitude when clicked. No matter where I'm standing, both always return zero. :-(

       

      I've triple and quadruple checked at I've listed "- gps" under "capabilities" in my build.yml. ;-)

       

      Has anyone any ideas what the problem might be?

       

      Thanks

      Graham