How can I launch Directions from GDK
Asked Answered
B

2

8

I'd like to tie into the directions functionality on Glass, in a similar method to the Mirror API Get Directions menu. Is there a way of launching directions via a URI within a GDK application?

Bitchy answered 20/11, 2013 at 4:26 Comment(1)
I'm very interested about this, thinking about creating navigation app which will lead you point to point. Have you tried calling Intent with ACTION_NAVIGATION? That would be my guess. If that works, we need to figure out parameter names for passing lat,lon AFAIK it's not documented anywhere.Analogous
R
10

Use the following intent to go to Saint-Malo, France the most beautiful city in the world :

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("google.navigation:q=48.649469,-2.02579"));
startActivity(intent);
Rossiya answered 21/11, 2013 at 15:43 Comment(0)
H
0

The log below was captured when launching built in navigation via "get directions"

11-20 22:26:58.087: I/NavigationActivity(14325): onCreate Intent { act=android.intent.action.VIEW dat=google.navigation:q=San+Diego&mode=mru flg=0x10000000 cmp=com.google.glass.maps/.NavigationActivity (has extras) }

It seems to show that you might be able to start activity class as "com.google.glass.maps.NavigationActivity" with Intent of "android.intent.action.VIEW " and data set to "google.navigation:q=San+Diego".

I've not actually try it, but it will be a good bet.

Update: after trying using 'adb am' command and it works, so this definitely should work from code prospective:

adb shell am start -n com.google.glass.maps/.NavigationActivity -a android.intent.action.VIEW -d google.navigation:q=92108
Hacienda answered 21/11, 2013 at 6:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.