1。 在storm 2(9550) simulator中返回的经纬度总是0,
html如下:
1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
2: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3: <head>
4: <title>GPS Testing</title>
5: <script "text/javascript">
6:
7: // called when location object changes
8: function locationCB()
9: {
10: alert("Latitude " +
11: blackberry.location.latitude);
12: alert("Longitude " +
13: blackberry.location.longitude);
14: return true;
15: }
16:
17: // test to see if the blackberry location API is supported
18: if( window.blackberry && blackberry.location.GPSSupported) {
19: document.write("GPS Supported");
20:
21:
22: // Set our call back function
23:
24: //WRONG: this would call our call back function immediatly, not after the refresh
25: //blackberry.location.onLocationUpdate(locationCB());
26:
27: //WRONG: the blackberry browser won't support passing a method.
28: //It will error on refresh and all javascript processing on the page will stop
29: //blackberry.location.onLocationUpdate(locationCB());
30:
31:
32: // RIGHT: pass a string that calls our method
33: blackberry.location.onLocationUpdate("locationCB()");