I am having an issue with the geolocation lat long data

// Expert user has replied.
S Subhajit Choudhury 3 years 6 months ago
6 2 0

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

Please Register or Login to post a reply

2 Replies

J Jon Tara

Real device, simulator, or RhoSimulator?

R Robert Galvin

What device and version of OS/Rho are you using?

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