LewisBenge
LewisBenge

Reputation: 2696

How can I launch Directions from GDK

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?

Upvotes: 8

Views: 1038

Answers (2)

Jul
Jul

Reputation: 1059

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);

Upvotes: 10

Gary S.
Gary S.

Reputation: 384

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

Upvotes: 0

Related Questions