Right now, I'm launching the Google Maps application with the following call:
String geoAddress = "maps.google.com/maps?q=";
geoAddress += LatLong[0] + "," + LatLong[1];
Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoAddress));
startActivity(i);
Which will open and place a marker at the specified position on the map. I have two questions:
1) How can I place multiple markers of which I have the Longitude/Latitude?
2) How can I start the Maps application to other modes (terrain/satellite/etc.)?
Thanks!
you can add multiple links on the map by using overlays,and u can see the GoogleMapview example in http://developer.android.com/resources/tutorials/views/hello-mapview.html.
here you can understand use of overlays.
Read the following links and download the code the link(For Further reference)
https://github.com/jgilfelt/android-mapviewballoons
https://github.com/jgilfelt/android-mapviewballoons#readme
2.To change the views use following functions,
mapView.setSatellite(true);
mapView.setStreetView(true);
For further reference
http://mobiforge.com/developing/story/using-google-maps-android
Related
In my application i want implement waze map navigation for multiple destination,i just achieved single origin and destination navigation ,but here i want to navigation multiple waypoints.
String url = String.format("waze://?ll=" + Double.parseDouble(_Lat) + "," + Double.parseDouble(_Long) + "&navigate=yes");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
I'm looking for a solution to the exact same problem.
Looks like they don't wish to provide - clueless why they are afraid people would use that.
Anyway, would it be possible that the activity which opened the intent also has a simple GPS listener which calculates when you're (almost) reached (or passed) your waypoint, and set the next coordinates (in the opened intent / or new one) ...?
For now I'm using google maps with a full URL, still I wish to send my users straight into navigation, not a browserwindow that may have or may not have a navigation button (Chrome versus other browsers).
A simple A to B is not working for me, I need a "A B C, break, C B A".
Im creating an app where users need to walk to a point on a map. But they need to find a route to the point by them selves.
Ive created a map with markers but by default if a user clicks on the marker a "start navigation" and "view in google maps" option is shown. Is it possible to disable these options ?
The options that are shown on marker click
This thing is called Map Toolbar. You can disable it by calling UiSettings.setMapToolbarEnabled(false):
GoogleMap map;
....... //init map
map.getUiSettings().setMapToolbarEnabled(false);
You can also define setMapToolbarEnabled() from the XML using the following property:
map:uiMapToolbar="false"
In kotlin you can do:
map.apply {
uiSettings.isMapToolbarEnabled = false
}
If anyone needs to do this in Google Maps v2, you set it in the map options instead of setting it on the map directly. So like this:
var mapOptions = new GoogleMapOptions().InvokeMapToolbarEnabled(false);
Here's my situation:
I have a list that will launch different pages for different places.
Each of these pages already have a WebView and MapView showing the
details and the map of the respective places (I used a TabHost)
I created an activity which extends ItemizedOverlay to enable me to place a marker, as well as to launch an alert dialog for my driving directions. This is used by all the MapView
I am able to launch driving directions from the alert dialog through the Google Maps app from my app so far. However, I have to put the lat and long values (actual numbers) in the Uri.parse("http://maps.google.com/maps...").
Is there a way to replace the lat and long values with strings from the Activity of the respective places?
P.S. Please pardon me as this is my first time posting here, and I am very new to programming =)
Try something like this:
String uri = "http://maps.google.com/maps" + String.format( "?daddr=%s,%s",
getLocationLat(),
getLocationLng() );
Intent i = new Intent( Intent.ACTION_VIEW, Uri.parse( uri ) );
startActivity( i );
I want to to change the google map view from one state to another. Currently the view is satellite view, now I want to change it to street view. I have written as below but it's not changing the view. How do I change the view at run-time?
mapView.setStreetView(true);
After that put this line and let me know what happen,
mapView.invalidate();
In your code you have to do something like,
mapView.setStreetView(true);
mapView.setSatellite(false);
mapView.invalidate();
Uninstall the project from the emulator and again run it.It hope it will work.
As the MapView reference shows, setStreetView does not change the map to street view - it only toggles showing the blue streaks indicating whether street view is available or not, on the map position you're currently looking at. I would guess that the easiest way to start street view is to start google's own street view app via StartActivity.
mapView.setStreetView(true);
Is depreciated.
try {
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.streetview:cbll="+my_lat+","+my_lng+"&cbp=1,99.56,,1,-5.27&mz=21"));
streetView.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(streetView);
} catch ( Exception ex ) {
Toast.makeText(getBaseContext(), "Could not launch Goole Street View. Are you sure it's installed? Launching market...", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=com.google.android.street"));
startActivity(intent);
}
Without the try/catch your app will crash if street view isn't installed.
See this possible duplicate
mapView.setStreetView(true);
mapView.setSatellite(false);
mapView.invalidate();
How to display streetview in android AVD?
I write map.setStreetView(true); but only display blue outline.
Also here is a site with an example in use (scroll down to step 7):
http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-launching-maps-in-app/
You have to build the string using your long and lat points, and then launch a new ACTION_VIEW intent.
For example:
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.streetview:cbll="+ latitude+","+longitude+"&cbp=1,99.56,,1,-5.27&mz=21"));
startActivity(streetView);
At the bottom:
http://developer.android.com/guide/appendix/g-app-intents.html
http://mapki.com/wiki/Google_Map_Parameters#Street_View
You have to tell it where you want to view:
map.getStreetView().setPosition(latLng:LatLng);
map.getStreetView().setVisible(flag:boolean)