Antwort

0

Google startet neue API: Google Maps URLs

https://developers.google.com/maps/documentation/urls/guide

Diese API

eine universelle, plattformübergreifende URL starten Google Maps und Suchen durchführen erstellen können, Holen Sie sich Wegbeschreibungen und Navigation und zeigen Sie Kartenansichten und Panoramabilder an.

Ab sofort kann man so etwas wie

Uri gmmIntentUri = Uri.parse("https://www.google.com/maps/dir/?api=1&origin=Space+Needle+Seattle+WA&destination=Pike+Place+Market+Seattle+WA&dir_action=navigate"); 
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 
mapIntent.setPackage("com.google.android.apps.maps"); 
startActivity(mapIntent); 

this helps verwenden können!

0

Verwendung unter Schnipsel:

String uri = "http://maps.google.com/maps?hl=en&saddr=" + currentlatLng.latitude + "," + currentlatLng.longitude + "&daddr=" + destination.latitude + "," + destination.longitude+ "&mode=driving"; 
       Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); 
       intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); 
       startActivityForResult(intent, Constants.REQUEST_OPEN_GOOGLE_MAP); 
+0

Google empfiehlt, die Google Maps-URLs: https://developers.google.com/maps/documentation/android-api/intents – xomena

+0

@xomena in meinem Szenario muss ich Verwenden Sie dies zum Öffnen von Google Map App mit Lat Lng. –

+0

Perfekt, das neue und gesegnete Google ist Google Maps URLs. Sehen Sie sich die Dokumentation an, diese URLs sind plattformübergreifend, sodass native Apps sie problemlos verstehen können. Die gleiche URL funktioniert mit Android, iOS oder Desktop-Browser. – xomena

Verwandte Themen