Action: SHOW_MAP

SHOW_MAP action is used to open the map displaying the desired address. For utilizing the map service provided by Google and Apple, you have to make sure that the service is enabled.

Example:

This example allows the user to enter any address and view the corresponding map.

<control type="TEXT" x="2" y="3" width="57" height="8" appearance_name="black" data_type="VARCHAR"
         default_value="Address"/>
<control type="EDIT" x="35" y="3" width="57" height="15" appearance_name="edit_box" data_type="VARCHAR"
         field_name="address" size="80"/>
<control type="PUSHBUTTON" x="35" y="21" width="57" height="8" appearance_name="blue_button" data_type="VARCHAR"
             default_value="SHOW_MAP">
            <actions>
                            <action event_list="TAP" action_name="SHOW_MAP"
                                  target="" input_parameter_list="address" />
            </actions>
    </control>
Android ../_images/map_form.png ../_images/android_map.png
iPhone ../_images/ios_mapform.png ../_images/ios_map.png

Reference tutorial

This chapter uses source code from appemble-tutorial-actions. If you have not downloaded tutorial source code, click on Download Source Code - Tutorials

Android - Right click on appemble-tutorial-actions and click on Run as Android application.

iOS - Select scheme appemble-tutorial-actions and iPhone x.x simulator. Click on Product -> Run.

Set up Android app to be published on Google play for map service

Make sure that yourproject/res/values/strings.xml has the following lines.

<!-- Google Places API url  -->
<string name="google_api_url_scheme">https</string>
<string name="google_api_url_host">maps.googleapis.com</string>
<string name="google_places_api_url_path">/maps/api/place/search</string>
<string name="google_place_details_api_url_path">/maps/api/place/details</string>
<string name="google_geocode_api_url_path">/maps/api/geocode</string>
<string name="google_api_default_format">json</string>
<integer name="google_places_api_default_radius">500</integer>
<string name="google_api_default_language">en</string>

When you test the app containing maps on the emulator, make sure that you run the app using avd with target Google APIs. If you do not have one create a new AVD with target Google APIs instead of Android 2.2.

../_images/avd_googleapis.png

To create a new AVD:

  • In Eclipse go to Windows | Android Virtual Device Manager
  • Click on New
  • Select any 4 inch device (preferably). You can create a device of your choice
  • Give a name to the AVD.
  • For SD Card you can give 200 MiB
../_images/avd_goog_ins.png

Set up iOS app for map service

TODO