Get ready to add a map renderer to the PhoneGap default app template. Execute the following steps:
Open the command-line tool and create a new PhoneGap project named
MapSample
:$ cordova create MapSample
Change the working directory to the newly created project:
$ cd MapSample
Add the required platform to the project. For example, we will add Android to this project:
$ cordova platform add android
Add the Geolocation API plugin using the following command:
$ cordova plugin add cordova-plugin-geolocation
Go to the
www
folder, open theindex.html
file, remove all the existing content, and add adiv
element with theid
value as#map
inside thebody
tag:<div id='map'></div>
Include the
cordova.js
file that will be added to the app at runtime:<script type="text/javascript" src="cordova.js"></script>
Add a new
script
tag to include the Google Maps JavaScript library. Replace theYOUR_API_KEY
value with your actual...