Get ready to add a map renderer to the PhoneGap default app template. Refer to the following steps:
Open the command-line tool and create a new PhoneGap project named
MapSample
.$ cordova create ~/the/path/to/your/source/mapmample com.gnstudio.pg.MapSample MapSample
Add the Geolocation API plugin using the command line.
$ cordova plugins add https: //git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
Go to the
www
folder, open theindex.html
file, and add adiv
element with theid
value#map
inside the main div of the app below the#deviceready
one.<div id='map'></div>
Add a new
script
tag to include the Google Maps JavaScript library.<script type="text/javascript" src="https: //maps.googleapis.com/maps/api/js?key= YOUR_API_KEY&sensor=true"> </script>
Go to the
css
folder and define a new rule inside theindex.css
file to give to thediv
element and its content an appropriate size.#map{ ...