I'm trying to open google maps from my application, setting a route from the phone current position to a fixed position. I'm using this code:
String uri = "https://maps.google.com/maps?saddr=&daddr=example";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);
The problem is that I don't know what to put in saddr= to reference my current position. I've found many other questions like this but no answer worked (such as leaving saddr= empty or saddr=Current, they don't work).
I don't want to use native android locator, I just want to know if there's a way to ask google maps "start from my current position".
You can explicitly to it to open in direction mode with an f=d
parameter. With that set and no start address, it should use the device's current location. So more like this:
"https://maps.google.com/maps?f=d&daddr=berlin"
Note: This doesn't work in a browser; it opens the directions page with a blank field for start. Used in an intent sent to the native maps application, it works correctly(at least on my 4.2.2 gNex).