howdy fellas,
when i have heard about Google Java Script API V 3's support for the
Blackberry OS 6 , i have tired to develop one Google map application
using phonegap.But it dint worked on my 9800 simulator and is giving
me JVM 104 error .NullPointerexception error. i have added access
element in config file for
maps.google.com and subdomains=true
is anyone here know how to get google maps java script api to work on
blackberry OS 6 apps ?? pls help
here i am pasting the code of my sample application, that i am using
to load google map in DIV tag,.
My code :--
=========
<!DOCTYPE HTML >
<html>
<head>
<meta name="viewport" content="width=device-width; height=device-
height; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html;
charset=utf-8">
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<title>Remind Me</title>
<link rel="stylesheet" href="/master.css" type="text/css"
media="screen" />
<script type="text/javascript" src="scripts/phonegap.js"></script>
<script type="text/javascript" src="
http://maps.google.com/maps/
api/js?sensor=false"></script>
<script type="text/javascript">
function loader() {
var state = document.readyState;
if (state == 'loaded' || state == 'complete') {
run();
} else {
if (navigator.userAgent.indexOf('Browzr') > -1) {
setTimeout(run, 250);
} else {
document.addEventListener('deviceready',run,false);
}
}
}
function run() {
var win = function(position)
{
// Grab coordinates object from the Position object passed into
success callback.
var coords = position.coords;
alert('Latitude: ' + position.coords.latitude +
'\n' +
'Longitude: ' + position.coords.longitude +
'\n' +
'Altitude: ' + position.coords.altitude +
'\n' +
'Accuracy: ' + position.coords.accuracy +
'\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy +
'\n' +
'Heading: ' + position.coords.heading +
'\n' +
'Speed: ' + position.coords.speed +
'\n' +
'Timestamp: ' + new Date(position.timestamp) +
'\n'
);
var map_canvass = initialize(coords.latitude,coords.longitude);
};
var fail = function(e) {
alert('Can\'t retrieve position.\nError: ' +
e);
};
var options = {};
options.enableHighAccuracy = true;
options.timeout = 30*1000;
navigator.geolocation.getCurrentPosition(win, fail,options);
}
function initialize(latitude,longitude) {
alert(latitude+"==="+longitude);
var latlng = new google.maps.LatLng(latitude,longitude);
//var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new
google.maps.Map(document.getElementById("map_canvas"),myOptions);
}
</script>
</head>
<body onload="loader();">
<div id="map_canvas" style="width:100%; height:90%" >Out of Luck</
div>
</body>
</html>