9 Replies Latest reply on Oct 11, 2012 1:55 AM by Amitsingh Chouhan

    Mapping & Geolocation

      Hi all,

       

      So I'm trying to follow the Mapping & Geolocation tutorial and I'm having trouble mapping a contact using the Android emulator.

      I've got my Google Maps API Key for Android in my build.yml file and the Google Maps API Key embedded in the map_it function map_params code.

       

      build.yml:

       

      android:
        version: "4.0.3"
        mapping: yes
        apikey: "0jlddkNGpIrPOt-06QPnFfz2voylS4rNDUmwIzA"
      
      

       

      customer_controller.rb:

       

      def map_it
          @customer = Customer.find(@params["id"])
            
          map_params = {
               :provider => 'Google',
               :settings => {:map_type => "hybrid",:region => [@params['latitude'], @params['longitude'], 0.2, 0.2],
                             :zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,
                             :api_key => 'AIzaSyCm70iH7mpd6vRNVe6Si5DAcP29x6KHiw0'},
               :annotations => [{:latitude => @params['latitude'], :longitude => @params['longitude'], :title => "Current location", :subtitle => ""},
                                {:street_address => "Cupertino, CA 95014", :title => "Cupertino", :subtitle => "zip: 95014", 
                                 :url => "/app/GeoLocation/show?city=Cupertino"},
                                {:street_address => "Santa Clara, CA 95051", :title => "Santa Clara", :subtitle => "zip: 95051", 
                                 :url => "/app/GeoLocation/show?city=Santa%20Clara", :pass_location => true}]
          }
          MapView.create map_params
          
      #    map_params = {
      #              :provider => 'Google',
      #              :settings => {:map_type => "hybrid",:region => [26.320527, -80.205353, 0.2, 0.2],
      #                            :zoom_enabled => true,:scroll_enabled => true,:shows_user_location => false,
      #                            :api_key => 'AIzaSyCm70iH7mpd6vRNVe6Si5DAcP29x6KHiw0'},
      #              :annotations => [{
      #                                  :latitude => 26.320527, 
      #                                  :longitude => -80.205353, 
      #                                  :title => "Steve Jobs", 
      #                                  :subtitle => "Go to customer",
      #                                  :url => "/app/Customer/{#{@customer.object}}"
      #                              }]
      #         }
      #    MapView.create map_params
      
      
          redirect :action => :index
        end
      
      

       

      Here, I'm using the mapping example given on the RhoMobile docs page just to see if that works.

       

      So my problem arises when I try showing the contact on a map.

      The map looks like it's loading, but it stays on the grey screen (see attached image).

       

      I've been trying to figure this out all day, but I can't seem to do it.

       

      Any help would be greatly appreciated!