Creating a Basic Interactive Map for Android.
First we must generate the phone gap project. For ease of use and in order to make it multiplatform, we'll use the cordova IDE.
1.-Create the Cordova App.
$ cordova create DIRNAME io.cordova.NAME APPTITLE
2.-Add the platforms we want the App to support.
$ cordova platform add android
3.-Check the installed platforms are correctly recognized.
$ cordova platforms ls
4.-Build the application.
$ cordova build
1.-Create the Cordova App.
$ cordova create DIRNAME io.cordova.NAME APPTITLE
2.-Add the platforms we want the App to support.
$ cordova platform add android
3.-Check the installed platforms are correctly recognized.
$ cordova platforms ls
4.-Build the application.
$ cordova build
Acquiring the Google Maps API Keys.
HelloWorld of Google Maps API.
Modify the Cordova file index.html and add the following:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style >
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_BROWSER_KEY">
</script>
<script >
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style >
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_BROWSER_KEY">
</script>
<script >
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"/>
</body>
</html>