4 Replies Latest reply on Jun 8, 2012 12:32 PM by Lobby Jones

    Rhosimulator : Simulating GPS Return

      Is there an easy way to get Rhosimulator to fake a GPS return value?

       

      @params['known_position'] in the code below is always 0, presumably because Rhosimulator is simulating not having GPS.

       

      I'm assuming this can be changed in a simulator config but I can't seem to find any documentation on how to do that.

       

        #-----------------------------

        #

        def storelocations   

         

            # check if we know our position  

            if !GeoLocation.known_position?

              # wait till GPS receiver acquire position

              GeoLocation.set_notification( url_for(:action => :geo_callback), "")

              redirect url_for(:action => :wait)

            else

              # show position

              render

            end

        end

       

        #-----------------------------

        #

        def geo_callback

            # navigate to `show_location` page if GPS receiver acquire position 

            if @params['known_position'].to_i != 0 && @params['status'] =='ok'

         

              GeoLocation.set_notification '', '', 2

              WebView.navigate(url_for(:action => :asynchttp))

            end 

        end

        • Re: Rhosimulator : Simulating GPS Return

          GPS simulation is not supported at this moment.

           

           

           

          Workaround may be set RhoTimer and call callback method form there with some fake data

          1 of 1 people found this helpful
            • Re: Rhosimulator : Simulating GPS Return

              Bummer.   If I push to my device the logic flow is different and dumps me to an "undefined" text output.

               

              In the simulator I am basically hitting the code logic that sets a default lat/long (our HQ location) if gps is coming back unknown and the app works fine.    

               

              Guess I need to come up with some creative debugging solutions.  Unfortunately PUTS and the other debugging output techniques don't seem to be working the way I expect.   I can't seem to get ANY sort of logging output other than the built-ins.  My in-app logging is going to the bit bucket or some other undisclosed file location. :/

                • Re: Rhosimulator : Simulating GPS Return

                  If you use rhosimulator log should be in rhosimulator folder and in RhoStudio output console

                   

                  Also check MinSeverity in rhoconfig.txt:

                   

                  MinSeverity = 1

                    • Re: Rhosimulator : Simulating GPS Return

                      I tried MinSeverity = 0 even, no luck.

                       

                      I see updated log info in the rhosimulator log file (lots of it), but I can never get either of these 2 lines with the asterisk to show up:

                       

                        #-----------------------------

                        #

                        def storelocations   

                         

                            puts "************* STORELOCATIONS **************"

                            app_info "*** STORE LOCATIONS ***"

                         

                            # check if we know our position  

                            if !GeoLocation.known_position?

                              # wait till GPS receiver acquire position

                              GeoLocation.set_notification( url_for(:action => :geo_callback), "")

                              redirect url_for(:action => :wait)

                            else

                              # show position

                              render

                            end

                        end

                       

                       

                       

                      I know the function is called (changing the navigate to wait screen will pull up another screen).

                       

                       

                      I can't seem to get logging to spit out any of my custom "tracing" output.