0

My android app has this code to catch links clicked with a google maps address

if (url.contains("https://www.google.com/maps/"))
            {
                Uri mapURL = Uri.parse(url);
                Intent mapIntent = new Intent(Intent.ACTION_VIEW, mapURL);
                mapIntent.setPackage("com.google.android.apps.maps");

                if (mapIntent.resolveActivity(getPackageManager()) != null) {
                    startActivity(mapIntent);
                }

This works as expected and loads google maps app, the problem is the addresses are breaking at the first comma. So for example if the link was

https://www.google.com/maps/dir/?api=1&origin=13 fake street, 
fake country&destination=13 fake street, fake country&travelmode=driving

I have tried urlencoding the clickable link with no difference.

Andrew Ward
  • 109
  • 2
  • 9
  • Possible duplicate of [Java URL encoding of query string parameters](https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters) –  Nov 12 '17 at 03:37
  • Just use `%20` instead of space. –  Nov 12 '17 at 03:41

0 Answers0