|
JavaScriptAPI
Include library in your html page: <script src="http://code.google.com/apis/gears/gears_init.js" type="text/javascript"></script> <script src="geo.js" type="text/javascript" ></script> Check if the phone is supported and get the coordinates //determine if the handset has client side geo location capabilities
if(geo_position_js.init()){
geo_position_js.getCurrentPosition(success_callback,error_callback);
}
else{
alert("Functionality not available");
}The callback parameters are aligned to the W3 Geolocation API Specification. The success_callback parameter provides at least: {coords:{latitude:theLatitude,longitude:theLongitude},timestamp:whenTheLocationWasRetrieved}The error_call callback parameter provides at least: {message:AMessageDescribingTheError,code:theErrorCode}Both callback parameters can contain more information if the acutal platform provides more. Sample URLs |
Sign in to add a comment