Reputation: 1093
I have a link of my custom made map in Google which includes marker to several destinations , what i want is to get the current Location
of user and show a marker or something on that location without disturbing my other markers in google map.
i have following Google map which i want to show in webView: https://www.google.com/maps/d/u/0/viewer?mid=1Wm3cIfP77Z8av8wGOi7xzQvrVxY
what modifications i should do in URL
or android code to make it work?
my attempt: https://www.google.com/maps/d/u/0/dir/Current+Location/viewer?mid=1qriRe112Bm54KPXEgtfeA6n2la8&z=5
[FAILED]
Edited:
https://www.google.com/maps/d/u/0/viewer?mid=1qriRe112Bm54KPXEgtfeA6n2la8&z=5&saddr=Current+Location
[FAILED]
Upvotes: 1
Views: 1975
Reputation: 17613
You can create an instance of a WebView and load the URL
of the Google Maps site. You can add parameters to the URL which allows you to use more functionality than is available using the Java-based Google Maps API.
Below code snippet shows how to create instance of a WebView to display a mobile Google Maps URL with parameters in an Android App. The main activity of your app should contain the following lines in its onCreate()
method.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView) findViewById(R.id.mywebview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://maps.googleapis.com/maps/api/staticmap?
ll=36.97,%20-122&lci=bike&z=13&t=p&size=500x500&sensor=true");
}
Upvotes: 1