2

I am using this code to open the Google Maps app in android.

if(source != null && destination != null) {
                    Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
                            Uri.parse("http://maps.google.com/maps?daddr="
                                    + destination.latitude + "," + destination.longitude + "(" + ADDRESS + ")"));
                    startActivity(intent);
                } else {
                    Toast.makeText(context, "Please check your internet connection and try again!!", Toast.LENGTH_LONG).show();
                }

What happens when it goes to the Google Maps app of android, at first it displays the ADDRESS in the destination box and "Your Location" in the source box but after that, it gets changed to "Point on Map". Is there any way by which I can avoid this? Or I am missing something?

Can anybody help me with this?

Aman Kush
  • 91
  • 2
  • 11
  • I face the same trouble, in the destination, at first it shows the exact label that we provided, after that it auto replaces with the actual address. Do you resolve this issue? – Phong Nguyen Apr 02 '18 at 03:46

1 Answers1

2

you can set markers to set Destination and Source Points on Google Maps

String uri = String.format(Locale.ENGLISH, "geo:%f,%f?z=17&q=%f,%f", sourcelatitude,sourcelongitude,destlatitude,destlongitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
Rajan Kali
  • 12,627
  • 3
  • 25
  • 37