Hi,
I have been through numerous searched results and rhomobile docs but could not get the geolocation working.
Following tutorials and explanations from various posts I have done the following but to no help ---
1) enabled capabilities to gps
2) added necessary code for the geolocation to work
Below is the response returned
APP| RHO serve: /app/GeoTest/geo_callback
Params: {"rho_callback"=>"1", "status"=>"error", "error_code"=>"12", "available"=>"0", "known_position"=>"0", "latitude"=>"0.0", "longitude"=>"0.0", "accuracy"=>"0.0"}
No matter what I do, everytime it is 0
below is my controller code
require 'rho/rhocontroller'
require 'helpers/browser_helper'
class GeoTestController Rho::RhoController
include BrowserHelper
def index
if !GeoLocation.known_position?
GeoLocation.set_notification(url_for(:action => :geo_callback), "", 2)
#redirect user to waiting/loading screen
else
redirect url_for(:action => :show)
end
end
def geo_callback
if @params['known_position'].to_i != 0 && @params['status'] == 'ok'
#turn off the Geolocation callback sync
GeoLocation.turnoff
puts "Location Found"
#forward to the page
WebView.navigate url_for(:action => :show)
else
puts "Disaster"
WebView.navigate url_for(:action => :show)
end
end
def show
render :action=> :show
end
end
What exactly needs to be done to get it working. Has it got something to do with RhoElements. Do I need to get the licensing?
Help would be very much appreciated
Thanks
2 Replies
Real device, simulator, or RhoSimulator?
What device and version of OS/Rho are you using?