Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show a geo location using webview

I want to show a particular geo location on google maps. I can't use mapview / mapactivity.

Also I can't use action view intent

Can I use webview for this?

like image 835
png Avatar asked Feb 19 '23 19:02

png


2 Answers

Open a url like this should work:

webView.loadUrl("http://maps.google.com/maps?q=47.404376,8.601478");

Replace 47.404376,8.601478 with your lat / long. Works in the browser, I guess on a mobile device it will open a mobile version of Google Maps.

like image 50
D-32 Avatar answered Feb 26 '23 22:02

D-32


Check out google Static Map API https://developers.google.com/maps/documentation/staticmaps/?hl=nl

You have to construct an url that displays a static image of a map (possible markers) of your location. you can then download it and display it in an imageview.

String latitude= "45.838211";
String longitude = "9.334661";
String url = "http://maps.google.com/maps/api/staticmap?center=" + latitude + "," + longitude+ "&zoom=10&size=400x400&sensor=false"
like image 38
noxius Avatar answered Feb 26 '23 21:02

noxius