Hi,
I have created a simple application for showing map, based on provided lat/lon. The app is working properly in Emulator but on device its not working. I am using WebView and Google's Java Script API to load the map. here is the code:
void MyApp::showMap(QString lat, QString lon)
{
// KEY ABQIAAAAwQNYrQEkTMgmCz45a3QXvxSN-sVMkTd7OLtH8gVp16673GU6nRQ1xCIdPzJW67z89BrUaXAxaGG7gg
ui->mapWebView->setHtml("<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><script src=\"http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAwQNYrQEkTMgmCz45a3QXvxSN-sVMkTd7OLtH8gVp16673GU6nRQ1xCIdPzJW67z89BrUaXAxaGG7gg&sensor=true_or_false\" type=\"text/javascript\"></script><script type=\"text/javascript\">function initialize() {if (GBrowserIsCompatible()) {var map = new GMap2(document.getElementById(\"map_canvas\"));var bounds = new GLatLngBounds; map.setCenter( new GLatLng(" + lat + "," + lon + "),16 ); var markers = new GMarker(new GLatLng(" + lat + "," + lon + ")); bounds.extend(markers.getPoint()); map.addOverlay(markers); map.setCenter(bounds.getCenter()); map.setUIToDefault(); }}</script></head><body onload=\"initialize()\" onunload=\"GUnload()\"><div id=\"map_canvas\" style=\"width: 330px; height: 555px\"></div></body></html>");
}
If you call this function showMap(yourLat, yourLon) It will work perfectly on emulator but on device it will show white screen. What may be problem ??

Reply With Quote




