Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Linking to Google Maps app
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bfeist  
View profile  
 More options Sep 8 2008, 11:19 am
From: bfeist <benjaminfe...@gmail.com>
Date: Mon, 8 Sep 2008 08:19:11 -0700 (PDT)
Local: Mon, Sep 8 2008 11:19 am
Subject: Linking to Google Maps app
Hi All,

Phonegap looks like just what the doctor ordered. Having a small issue
though:

A link to google maps within iPhone Safari automatically links to the
iphone maps app (very handy). However, when clicking the same link
within Phonegap's UIWebView object, it actually loads the google maps
website within the UIWebView.

I want the link to open the maps app. Is there a specific call that I
can use? Any help is greatly appreciated.

Ben


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bfeist  
View profile  
(1 user)  More options Sep 11 2008, 10:09 am
From: bfeist <benjaminfe...@gmail.com>
Date: Thu, 11 Sep 2008 07:09:57 -0700 (PDT)
Local: Thurs, Sep 11 2008 10:09 am
Subject: Re: Linking to Google Maps app
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google