GeoLocation.known_position always returns zero

// Expert user has replied.
G Graham Downs 3 years 6 months ago
1 1 0

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

Please Register or Login to post a reply

1 Replies

P Pietro Francesco Maggi

Hi Graham,
so, we are talking about iOS and iPad here, if I understand correctly.
which iOS version?

Does the application has the permission to get location position? (did you got iOS asking for permission to send location info to your apps)?

~Pietro

CONTACT
Can’t find what you’re looking for?