4 Replies Latest reply on Apr 24, 2013 11:24 PM by Kutir Mobility

    Beginner Help - Trying to get a map to start.

      Hello I just started using RhoMobile today not ever have using Ruby before so I'm not sure if I'm having trouble because of that or because I'm not setting it up right. I tried following the tutorial word-for-word to add a google map to one of my pages. On the index I changed the link to call map_it in the controller.

       

      [code]

      <div data-role="content">

          <ul data-role="listview">

            <li><a href="<%= url_for(:action => :map_it) %>">Go to Map</a></li>

          </ul>

        </div>

      [/code]

       

      And added this below the login method in the controller.js file- this is where I assumed it would go.

       

      [code]

      def map_it

              map_params =

              {  

                      :settings => {:map_type => "hybrid", :region => [30, -80, 0.2, 0.2], :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => false, :api_key => ""},

                      :annotations => 

                      [{ 

                              :latitude => 30,

                              :longitude => -80,

                              :title => "Here is a marker",

                              :subtitle => "Marker!",

                              :url => "#"

                      }] 

              }  

              MapView.create(map_params)

              redirect :action => :index

        end

      [/code]

       

      The only changes I made in the above are that I took out the api_key (I don't know if it's necessary since the google maps api for js doesn't require it anymore) and the url for the annotation (I don't have one yet, I just want to get the map started).

       

      Now when I click the Go to Map button on the index it says "Error Loading Page" but I don't know why. Was I supposed to install a google maps gem or something?

       

      Also a side question- why are some variables aren't prefixed (map_params), some are prefixed with the at sign (@params) and some are prefixed with a colon (:map_type and :action).

        • Re: Beginner Help - Trying to get a map to start.
          Kutir Mobility

          Hi Micah,

          Do you see some error in Javascript console or Rholog.txt? If so can you paste them here.

          Also, have you managed to run the sample app https://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/GeoLocation successfully on your emulator?

           

          Thanks

          Surendran S

          Kutir Mobility

            • Re: Beginner Help - Trying to get a map to start.

              Ok so I downloaded the entire application and tried to run it but got this failure on compile.

               

              RET:pkg: /data/local/tmp/rhodes-system-api-samples-debug.apk

              RET: Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]

              rake aborted!

              Missing shared library: application is not compatible with started emulator due to lack of required libraries

              /var/lib/gems/1.9.1/gems/rhodes-3.5.1.12/platform/android/build/android_tools.rb:382:in `load_app_and_run'

              /var/lib/gems/1.9.1/gems/rhodes-3.5.1.12/platform/android/build/android.rake:1975:in `block (3 levels) in <top (required)>'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'

              /var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'

              Tasks: TOP => run:android => run:android:emulator

              (See full trace by running task with --trace)

              ********* WARNING ************************************************************************

              The following features are only available in RhoElements v2 and above:

              - Barcode extension

              - NFC extension

              - Raw Sensors

              - Audio Capture

              For more information go to http://www.motorolasolutions.com/rhoelements

              **************************************************************************************