Alright, no response so I built this myself. I don't think I'll add it
to the base project source repository due to all the changes I made,
but the detail of what I did is below.
Approach:
iPhone 2.0+ uses a different URL method to open maps in the map app
than iPhone 1.0+ did
old: http://maps.google.com/q=<query string>
new: maps:q=<query string>
Safari intercepts these calls and opens the maps app. Unfortunately a
UIWebView does NOT (thank you Apple)
I changed the GlassAppDeligate.m file to accept a new directive called
"openmap" that would take a "q=<query string>" parameter and create a
call to safari in the form "maps:q=<query string>"
I added the appropriate hooks in gap.js to pass the openmap directive
through Device.Map.open("string").
Code Changes:
JS:
I had to change gap.js to delimit commands by "::" instead of ":" due
to "http://" type urls interfering with the command delimiting (this
is needed when loading KML files into the maps app)
Added the following JS code to the Device function:
Map: {
// available: true,
lon: null,
lat: null,
callback: null,
open: function(url) {
Device.exec("openmap::" + url);
}
},
Objective-C:
Changed GlassAppDeligate.m to delimit commands by "::" as well (see
above)
Code added to GlassAppDeligate.m (- (bool)webView... method) below
the vibration stuff.
//Google maps call
else if([(NSString *)[parts objectAtIndex:1]
isEqualToString:@"openmap"]) {
NSLog(@"Map request!");
NSLog([parts objectAtIndex:2]);
NSString *mapurl = [@"maps:" stringByAppendingString:[parts
objectAtIndex:2]];
NSLog(mapurl);
[[UIApplication sharedApplication] openURL:[NSURL
URLWithString:mapurl]]; //use safari to launch google maps url, which
redirects to google app
}