openmap in PhoneGap .80 on iPhone

519 views
Skip to first unread message

Chadly

unread,
Nov 17, 2009, 10:56:18 AM11/17/09
to phonegap
I opened the demo app that came with PhoneGap and built it and it runs
no problem.

Simply added this line and it does not work:

<a class="btn" href="#" onclick="Device.exec('openmap:q=roma');">Roma</
a>

builds fine, but once you touch that button, nothing...

I have searched and read everything I can find, so only helpful
replies, please...

Thanks in advance,
Chad

hanger

unread,
Nov 17, 2009, 11:23:12 AM11/17/09
to phonegap
I don't know about openmap, but calls to map (google map) will open
the mobile browser. (so you leave the app ;-( )

MapKit is a way to embed maps directly into your application. It
works perfectly on Iphone sdk3 , no idea for the other plateforms.

I integrated a mapkit access/usage into phonegap, I plan to publish
it ... I "just" need to have some spare time to clean my code.
Tell me if you wish to have the dev-code ..
Marc

Shazron Abdullah

unread,
Nov 17, 2009, 1:23:38 PM11/17/09
to Chadly, phonegap
Try a document.location = 'openmap:foo'; instead

Chadly

unread,
Nov 18, 2009, 1:42:05 PM11/18/09
to phonegap
Hey Marc, I would love to have the dev code for the MapKit! Can you e-
mail it to me?

cra...@mediamarketers.com

Thanks!
Chad

hanger

unread,
Nov 19, 2009, 12:00:54 PM11/19/09
to phonegap
To keep you waiting .. I'll open a git ASAP.

it manages mutliple marker color / location, and annotation callback
(=when you click on a annotation)

1) I had no time to clean the code, so use it if you need, and don't
forget to publish your comments/corrections etc ...
2) I'm a developper, but it's my first ObjectiveC code .. so be
tolerent ;-)


Usage:
1) To add points
PhoneGap.exec("Map.addPoint",data[i].latitude,data[i].longitude,data
[i].title,data[i].title,"purple","processmapclick('"+data[i].nid
+"')");
2) to display the map
PhoneGap.exec("Map.center",geoParams.lat,geoParams.long,0.4,0.4);
3) to reset and hide the map (I call it via a tabbar)
PhoneGap.exec("Map.reset");




In Map.h
----------------

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>
#import "PhoneGapCommand.h"


@interface AddressAnnotation : NSObject<MKAnnotation>
{
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
NSString *color;
NSString *callback;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, copy) NSString *callback;
@property (nonatomic, copy) NSString *color;
@end




@interface Map : PhoneGapCommand <MKMapViewDelegate> {
MKMapView *mapView;
AddressAnnotation *myAnnotation;
bool canReset;
}

- (void) init:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;
- (void) addPoint:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)option;
- (void) reset:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;

@end


Map.m
--------------------------------------------------


#import "Map.h"

@implementation AddressAnnotation
@synthesize coordinate, title, subtitle,callback,color;

-(void)dealloc
{
[title release];
[subtitle release];
[callback release];
[color release];
[super dealloc];
}
-(id)initWithCoordinate:(CLLocationCoordinate2D) c{
coordinate=c;
NSLog(@"%f,%f ok",c.latitude,c.longitude);
return self;
}
@end



@implementation Map



- (void) init:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;
{
NSLog(@"map:init");

if (mapView){
[mapView removeAnnotations:mapView.annotations];
NSLog(@"map:dealloc");
}
if (!mapView){
NSLog(@"map:init try to create view");
UIViewController* c = [super appViewController];
mapView=[[MKMapView alloc] initWithFrame:c.view.bounds];
mapView.showsUserLocation=true;
//mapView.mapType=MKMapTypeStandard;
mapView.mapType=MKMapTypeHybrid;
//mapView.delegate=c;
[mapView setDelegate:self];
}
}

- (void) center:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;
{

NSUInteger argc = [arguments count];
float longitude,latitude,longitutedelta,latitudedelta;

if (argc > 0) latitude = [[arguments objectAtIndex:0] floatValue];
if (argc > 1) longitude = [[arguments objectAtIndex:1] floatValue];
if (argc > 2) latitudedelta = [[arguments objectAtIndex:2]
floatValue];
if (argc > 3) longitutedelta = [[arguments objectAtIndex:3]
floatValue];

NSLog(@"map:center");
/*
NSLog(@"lattitude %@",latitude);
NSLog(@"longitude %@",longitude);
NSLog(@"latitudedelta %@",latitudedelta);
NSLog(@"longitutedelta %@",longitutedelta);
*/
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=latitudedelta;
span.longitudeDelta=longitutedelta;
CLLocationCoordinate2D location;
if (latitude!=0){
location.latitude=latitude;
location.longitude=longitude;
} else {
location=mapView.userLocation.coordinate;
}

region.span=span;
region.center=location;
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
UIViewController* c = [super appViewController];

[c.view insertSubview:mapView atIndex:1];
canReset=true;
}


- (void) reset:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;
{
NSLog(@"map:reset");
//UIViewController* c = [super appViewController];
//[c.view sendSubviewToBack:mapView];
if (!canReset) return;
NSString * jsCallBack = @"resetTabBar()";
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];

[mapView removeFromSuperview];
canReset=false;
//- (void)bringSubviewToFront:(UIView *)view
//- (void)sendSubviewToBack:(UIView *)view
}
- (void) addPoint:(NSMutableArray*)arguments withDict:
(NSMutableDictionary*)options;
{

NSUInteger argc = [arguments count];
float longitude,latitude;
NSString* title = nil, *subtitle = nil, *color = nil,*callback=nil;
if (argc > 0) latitude = [[arguments objectAtIndex:0] floatValue];
if (argc > 1) longitude = [[arguments objectAtIndex:1] floatValue];
if (argc > 2) title = [arguments objectAtIndex:2];
if (argc > 3) subtitle = [arguments objectAtIndex:3];
if (argc > 4) color = [arguments objectAtIndex:4];
if (argc > 5) callback = [arguments objectAtIndex:5];


NSLog(@"map:addPoint");
if (0==1){
NSLog(@"latitude %@,longitute %@,title %@,subtitle %@,color
%@",latitude,longitude,(NSString *)title,(NSString *)subtitle,
(NSString *)color);
}
if(0==1 && myAnnotation != nil) {
[mapView removeAnnotation:myAnnotation];
[myAnnotation release];
myAnnotation = nil;
}

CLLocationCoordinate2D location;
location.latitude=latitude;
location.longitude=longitude;

myAnnotation = [[AddressAnnotation alloc]
initWithCoordinate:location];

myAnnotation.title=title;
myAnnotation.subtitle=subtitle;
myAnnotation.callback=callback;
myAnnotation.color=color;

[mapView addAnnotation:myAnnotation];


}

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView
*)view calloutAccessoryControlTapped:(UIControl *)control {
AddressAnnotation* annotation=[view annotation];
NSString * jsCallBack = [NSString stringWithFormat:@"%@",(NSString *)
annotation.callback];
if (jsCallBack!=@"")
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];

}
//Function to set the annotation
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:
(id <MKAnnotation>) annotation{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"currentloc"];

NSString* title=[annotation title];
NSRange r = [title rangeOfString:@"urrent"];
//NSString* substr = [title substringWithRange:r];


if( r.location != NSNotFound) {
NSLog(@"Using green");
[annView setPinColor:MKPinAnnotationColorGreen];
annView.animatesDrop=TRUE;
annView.canShowCallout = YES;
//annView.pinColor = MKPinAnnotationColorGreen;
} else {
NSLog(@"annotation title .%@.",(NSString *)[annotation
title]);
NSLog(@"Using Purple");
NSString* color=[annotation color];
NSRange rr = [color rangeOfString:@"red"];
if( rr.location != NSNotFound)
[annView setPinColor:MKPinAnnotationColorRed];
else
[annView setPinColor:MKPinAnnotationColorPurple];
//annView.pinColor = MKPinAnnotationColorPurple;
annView.animatesDrop=TRUE;

annView.canShowCallout = YES;
UIButton *disclosureButton = [UIButton buttonWithType:
UIButtonTypeDetailDisclosure];
annView.rightCalloutAccessoryView = disclosureButton;
}
return annView;
}
@end




Chadly

unread,
Dec 9, 2009, 10:23:15 PM12/9/09
to phonegap
Thanks so much for your code! I have it loaded and no errors, but how
exactly would I display a map center?

I am executing this in phonegap, but nothing happens:

PhoneGap.exec("Map.center",39.188402,-85.568948,0.4,0.4);

Thanks!

Chadly

unread,
Dec 9, 2009, 10:33:53 PM12/9/09
to phonegap
OK searched some more... Added this before my line and it works now!
Thanks so much for the code!!!!

PhoneGap.exec("Map.init");

Nicolas

unread,
Jan 6, 2010, 11:45:08 AM1/6/10
to phonegap
thx hanger for your work, but unfortunaly it doesn't work.
I get this error :

".objc_class_name_MKPinAnnotationView", referenced from:


literal-pointer@__OBJC@__cls_refs@MKPinAnnotationView in Map.o


Maybe You had this error before. I don't know what that means. Anyone
have an idea ???? :-(

hanger

unread,
Jan 6, 2010, 12:43:07 PM1/6/10
to phonegap
Are you sure you included
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>

And you add mapkit to your project ?

Nicolas

unread,
Jan 9, 2010, 7:53:37 AM1/9/10
to phonegap
sorry, it perfectly works. I forgot to add mapkit.
thanks. I'm gonna try to use it.

Nicolas

unread,
Jan 13, 2010, 4:17:02 AM1/13/10
to phonegap
Hi hanger, again...

I am just like a newbie in the iphone world. I'm trying to see all
functionnalities. I really like this framework but i don't understand
everything. when you said :

" to reset and hide the map (I call it via a tabbar) PhoneGap.exec
("Map.reset"); "

what do you do, how can you add a tabbar with the framework
Phonegap ??? directly in XCode, maybe you can show me a example or a
way to do it.

Merci par avance.

hanger

unread,
Jan 13, 2010, 4:47:21 AM1/13/10
to phonegap

summer

unread,
Jan 17, 2010, 11:27:11 PM1/17/10
to phonegap
Hi hanger,

I am summer from Taiwan, I had try your code, but I have 2 error,

1. error:expected specifier-qualifier-list before 'AddressAnnotation'
2. error:'myAnnotation' underclared (first use in this function)


can you help me to solve, please!

hanger

unread,
Jan 18, 2010, 8:21:43 AM1/18/10
to phonegap
Hi Summer !
Did you include
#import <MapKit/MapKit.h>
#import <MapKit/MKAnnotation.h>

And

did you include the Mapkit libraries into your project libraries ?

summer

unread,
Jan 18, 2010, 8:34:24 AM1/18/10
to phonegap
Hi...hanger

thanks for your help, I already fix my trouble...

but the next question is how can I show the map in my html &
javascript code???.....it's my first time to code Phonegap....so I
don't know very much to use it, could you mail the sample to
me??...thanks very much~~

hanger

unread,
Jan 18, 2010, 10:44:58 AM1/18/10
to phonegap

mapkit open in "full window", so it's not possible to include it in an
html object. I used the tabbar (http://groups.google.com/group/
phonegap/browse_thread/thread/715ed101ab6dd9c4/82ce06eed56c956c) in
order to open or close the mapview)

in the listed point, function 3) is called by the tabbar, so the user
can go back to the app "normal" webview. Fct 0)1)2) is called by any
javascript you want

0) To initialize PhoneGap.exec("Map.init")


1) To add points
PhoneGap.exec("Map.addPoint",data[i].latitude,data[i].longitude,data
[i].title,data[i].title,"purple","processmapclick('"+data[i].nid
+"')");
2) to display the map
PhoneGap.exec("Map.center",geoParams.lat,geoParams.long,0.4,0.4);
3) to reset and hide the map (I call it via a tabbar)
PhoneGap.exec("Map.reset");

ex:
try {
if (PhoneGap){
PhoneGap.addConstructor(function(){
uicontrols.createTabBar();
uicontrols.createTabBarItem("georeset", "Back","02-redo.png",
{onSelect: function() { PhoneGap.exec("Map.reset"); }} );
uicontrols.showTabBarItems("georeset");
uicontrols.showTabBar();
}
}catch (err){
//whatever
}


Jann Gobble

unread,
Jan 18, 2010, 3:10:11 PM1/18/10
to phonegap
For those of you who care, I have full instructions here:

http://code.google.com/p/jqtouch/issues/detail?id=44#c46

Those instructions were for the same thing although posted to the JQTouch group as a fix to google maps api v3 inability to work within the JQTouch (or really, any webview) well.

Jann

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com

summer

unread,
Jan 18, 2010, 11:43:05 PM1/18/10
to phonegap
Dear hanger,

I try to create a TabBar, my code is like below, it can alert start
and finish, but didn't show any tabbar in my simulator...what wrong
with me??....should I do any config??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html;
charset=utf-8">
<title>Test</title>
<link rel="stylesheet" href="master.css" type="text/css"
media="screen" title="no title" charset="utf-8">
<script type="text/javascript" charset="utf-8" src="phonegap.js"></
script>
<script type="text/javascript" charset="utf-8">
function setupToolbars(){
try{
var toprated = 0;
navigator.notification.alert("start");
uicontrols.createToolBar();
uicontrols.setToolBarTitle("Tool Bar");

uicontrols.createTabBar();
uicontrols.createTabBarItem("toprated","Top
Rated","tabButton:TopRated",{onSelect:function(){
navigator.notification.alert("Top Reated select");
}});
var history = 0;
uicontrols.createTabBarItem("history","History",null,
{onSelect:function(){
navigator.notification.alert("History select");
}});
uicontrols.showTabBar();
uicontrols.showTabBarItems("toprated","history");
navigator.notification.alert("finish");

}catch(err){
alert(err);
}
}

function preventBehavior(e){
e.preventDefault();
}

PhoneGap.addConstructor(function(){
setupToolbars();
document.addEventListener("touchmove",preventBehavior,false);

});

</script>

</head>
<body id="stage" class="theme">
<div id="Page1">
<h1>Tab Bar</h1><br>

</div>
</body>
</html>

hanger

unread,
Jan 19, 2010, 3:37:27 AM1/19/10
to phonegap
Strange, it seems correct, try to inverse

uicontrols.showTabBarItems("toprated","history");
uicontrols.showTabBar();

summer

unread,
Jan 19, 2010, 5:06:02 AM1/19/10
to phonegap
Hi hanger

I don't know what happen, but when I copy my code to default html page
(index.html), my tabbar appear~~~

but if I put the code to another page, it's disapper.......

but anyway~~ thanks for your help very much...

hanger

unread,
Jan 19, 2010, 5:13:57 AM1/19/10
to phonegap
ahhh ! I understand.
There seems to be an issue with phonegap functionnalities : there are
only available in the "index.html", not in subpages. You should ONLY
use index.html, and manage your content with jquery/javascript/json
I can't find the message reference on phonegap group, but I remember
that there was a recent discussion on that issue.

Thomas

unread,
Jan 19, 2010, 7:14:29 AM1/19/10
to phonegap
Hi Hanger,

Thanks for sharing your bit of code, I bet tons of non-obj-c people as
myself will be grateful to you.

Had one question though, have you tried to run it with the EDGE
version? Just tried but the file structure/code organization changed a
bit and I believe cause of that just changing the referenced Map.m,
Map.h doesn't work anymore. Had it working in 0.8 no problems but now
I'm stuck - wanted to work with edge for the future app as I'd love to
use some of its features - though at the same time we'd love to use
your contribution :)

Oh and just a tiny idea, maybe parametrize the initializer to give an
option to pass which type of map do we want to display? Found in your
code that you were changing it be uncommenting which enum from MKType
to use :) would be sweet if you could pass it while displaying the map
from JS

thanks again,
Tomas

hanger

unread,
Jan 19, 2010, 8:33:32 AM1/19/10
to phonegap
You are welcome, I happy to see this code being used ...
I tried to clone the latest git but it is empty ?!? ... Isn't a map.h
& map.m present in your new git ? At the 0.8 time, there were almost
empty, so you just can replace existing content and try ..

Thomas

unread,
Jan 19, 2010, 10:25:15 AM1/19/10
to phonegap
You have to get the latest build from GIT, the download isn't working
for EDGE version. ( http://phonegap.pbworks.com/Getting+Started+with+PhoneGap+(iPhone)
)

The map.h and map.m files haven't changed at all I recon but the way
they are linked did - they aren't directly accessible from your
phonegap project anymore - all the core classes were separated from
what PhoneGap dev will see in his PG based project. There might have
been more changes to it which are beyond my scope of understanding Obj-
C.

The thing is that everything seems to load fine - there are no
compilation errors, just when I click the html element which should
call the map the simulator crashes and the debugger throws an unknown
exception error.

T.

hanger

unread,
Jan 19, 2010, 12:12:40 PM1/19/10
to phonegap
To be true: I'm not an objective-C devel, and I'm not friend-freind
with it. I build that code by assembliing piece of code found on the
net.

Did you include the mapkit framework, I supposed otherwise the project
wouldn't even build ...

Did you try to display a map directly = without using other native fct
like tabbar, or geolocation ...

Jann Gobble

unread,
Jan 19, 2010, 12:41:47 PM1/19/10
to phonegap
You know, to be honest, I am shocked (and disappointed) at the lack of 'official' PhoneGap response to issues surrounding mapping and Mapkit.

Mapping is a major feature of mobile platforms in general (and the iPhone in particular). It is EXTREMELY lacking in .8 Someone (Marc), puts together a working prototype of a solution -- and gets NO RESPONSE from any of the developers of PhoneGap. Others (like me) ask specific questions aimed at the developers and get no response. (Like the one on location services this morning. Asked almost 2 weeks ago as well..and no answer then either) It seems that PhoneGap gets all this good press, developers really start using it, the forums get going and the PhoneGap developers go away (or assume that they do not need to answer questions regarding a major missing feature).

Marc has openly placed his code out there for use of all. PhoneGap developers should immediately incorporate this mapping code and replace the paltry one-function feature we had in the past. Are there memory leaks in it? Is is written wrong? Is he breaking any rules that would stop an app from being accepted by the app store? He has asked for it to be accepted and for someone to look at it who knows Objective-C better then he. HE DID YOUR WORK FOR YOU, DEVS. Where are you?

Come on, devs... This is obviously a needed feature. The code is written. What is to stop it from being immediately added to the codebase of PhoneGap? To be honest, the lack of any PhoneGap dev 'noise' on this list is disappointing. I know this is a sideline for most of the PhoneGap devs...but if you look out there at the postings you will find that many of us software developers actually chose this platform to port (or create) software on. Many of us have bosses to please. For some of us it is for fun, for other -- profit. Shouldn't our questions get answered? Aren't we the ones that got PhoneGap noticed? The reason Perl (for instance) got so huge is that Larry Wall got involved in the day-to-day question/answers. Same thing with Linux. I would hope PhoneGap could learn from things like that. When dealing with a brand-new platform you must have original-developer involvement to both answer questions and prosthetize.

No offense meant by any of this...and I am not mad. I am puzzled. Thoughts?

Jann

Jesse MacFadyen

unread,
Jan 19, 2010, 1:29:21 PM1/19/10
to Jann Gobble, phonegap
Thanks Jann,

We are listening,

Unfortunately we have been extremely busy, and have not had time to look into this.  It seems everyone thinks we sit around and write PhoneGap all day, or sit around and do nothing.  The reality is, we are developers with clients ourselves, and their needs have to come first.  Much of the work we contribute is done on our own time, because we believe in the project, and if we have written something for a client that makes sense for inclusion, we give back.

That said, I will be following up on the Geo issues you mentioned, and I will review the Map code this week.

I will also be posting information on how developers can contribute back, posting code to the mailing list is difficult to deal with, and the git repo is easily forked.  Our biggest task in front of us right now is making plug-ins work simply so that giving back can be easier.

Thanks for speaking up and saying what many may have been feeling.

Regards,
  Jesse
--
Jesse MacFadyen

blogs.nitobi.com/jesse
jesse.m...@nitobi.com

Thomas

unread,
Jan 20, 2010, 5:42:31 AM1/20/10
to phonegap
Hey again,

managed to debug it a beet deeper and I've found out that the
exception was raised by the execute command that the method called is
unknown - that would mean that I was right in the first post, that
because the way the way all the classes are included now changed it's
not that easy to *hack* the PhoneGap code anymore.

Any tips from the authors maybe? I've changed the classes in the
folder from which I've installed the PhoneGap EDGE templates and all
the xcode project creation stuff (GREAT IDEA!) I guess that I'd have
to edit the template itself somewhere deeper to apply the changes to
the mapping system (Map.h, Map.m)?

Oh and yeah it was just the map without anything extra and I did
include the mapkit framework.

Tom

venky

unread,
Jan 20, 2010, 6:01:17 AM1/20/10
to phonegap
Hey all,

I am new to phonegap and to mobile development as a whole though have
some experience in web development.
Pardon me if m missing something but why are we going for a full
screen map? Cant we just call the API and do regular ajax calling for
search n stuff and embed it in a html page like we do in websites.
This way we can always have a back button so the application wont
quit.
Experts may throw some light on this...

Venky

hanger

unread,
Jan 20, 2010, 7:55:49 AM1/20/10
to phonegap
Hi Jesse !
Thanks for your feed-back.
I think we are all thanks-full for all the work you did & are doing.
You point out exactly the limitations&adavntages of shared-development
tools. Most of the potential contributors share their time between
several tasks/missions/customers, that's why participation is a main
point in such project.
Hopefully, phonegap should get not only questions & features requests
but also contributions as mapkit integration is. That would make the
project more stable, more universal more bla bla bla ...
Your team should be responsible of quality & project managment, tasks
that will already take a lot of your time.
Maybe a good start point would be to have a tools (idependent from
this mailing) for contributions submission, bugs reporting & features
request.

Again : thanks for your work .. you keep many of us from the nightmare
of dealing with objective-c ...
++
Marc

hanger

unread,
Jan 20, 2010, 7:59:40 AM1/20/10
to phonegap
Hi venky,

> Pardon me if m missing something but why are we going for a full
> screen map?

because (unfortunately) that's not the way mapkit implement
googlemap. They only open in full screen (at least from what I know).

> search n stuff and embed it in a html page like we do in websites.
> This way we can always have a back button so the application wont
> quit.

You can embed gmap, but you cannot use the gmap api, which require a
key, which can not work on phonegapapp(or any iphone app)
and embeded maps have few options and is very slow ..

ade

unread,
Jan 20, 2010, 8:07:59 AM1/20/10
to phonegap
my phonegap iphone app uses both types of gmaps - on the wifi listings if you click on the link it opens up the location on the iphones native google map but ive also used standard google maps html pages for the beaches, towns, petrol stations   (its a free app - search for phone ibiza in itunes)

localhost's dont need a gmap api key and thats essentially whats happening on your iphone app - the bottom line is that if your google map html works on safari on your local machine it should work on the iphone (obviously you have to think about zooming and scrolling which is why ive used icons to do that)
--
ade
...........................................................................................
www.ibizaA-Z.com
www.iphoneibiza.com
www.podcast-ibiza.com
www.ishopibiza.com
www.ibiza-blog.com
www.ibizawinter.com
www.ibizaa-z.com/webcam
http://twitter.com/blogibiza
Ibiza NOW - The Islands Magazine

hanger

unread,
Jan 20, 2010, 8:20:23 AM1/20/10
to phonegap
Yes there is that third way to view map
1) Embeded map
2) map kit
3) open the native "google map" application(dont know the name ..),
but the HUGE disadvantage is that it closes your app, to open an other
one ! I'm currently developing an app based on stores geolocation,
I'm sure that my app would become totally unusable if the user has to
"swap" between the native app and mine

rem: good info for the localhost .. didn't know that.

venky

unread,
Jan 20, 2010, 8:23:29 AM1/20/10
to phonegap
Thats xactly wat i was talkin about.
I tried making a static html page with gmap embedded in it n compiled
it with phonegap.
The results r pretty good. I can even pinch zoom and scroll through.
Tried using localsearch n that works fine too.
The only thing that bothers me is speed.
Note:- I tried it only on simulator and not on the real device. Will
try it later when i get home and post the results here.

Venky

> www.ibizaA-Z.comwww.iphoneibiza.comwww.podcast-ibiza.comwww.ishopibiza.comwww.ibiza-blog.comwww.ibizawinter.comwww.ibizaa-z.com/webcamhttp://twitter.com/blogibiza

Jesse MacFadyen

unread,
Jan 20, 2010, 11:10:10 AM1/20/10
to Thomas, phonegap
You should be able to drop your map (.m/.h) files into your own
project and not modify the phonegaplib project. Then put your map js
implementation file in your www folder and include it from HTML.

The goal was to not need to modify the lib project. If you modify
phonegap lib, then you are stuck if there are updates and you will
have to manually merge code.

I assume map.m is implementing phonegapcommand.

Let me know if you still have issues.

Jesse


Sent from my iPhone

Jann Gobble

unread,
Jan 21, 2010, 11:28:01 AM1/21/10
to phonegap
ps: Did ya'll hear about the supposed Microsoft/Apple talk about using Bing (for maps/search)?

http://bit.ly/5T1mRw

Not to mention Google stepping foot in yet ANOTHER market Apple wants to dominate (movie rentals)

http://bit.ly/92BJ3S

Think about it... how soon after Apple drops Google do you all think Google will fire back and kill all the apps accessing Google Maps illegally?

Mapkit WILL work in the future. There is nothing using it's facilities that lock it to a Google interface. With Frameworks that are 'supported' by Apple, it is almost always guaranteed for them to (transparently - hopefully) enable it to be used with another provider. Your App would continue to work regardless of any 'business' decisions Apple may make in the future. (can you say Bing or Placebase?)

:) That is my hope anyway. Only time (and Bing or Placebase) will tell. I can see apple foaming at the mouth at having Aerial shots of (Microsoft's Bing) neighborhoods to use on the iPhone vs Satellite shots (Google)

(not that I love Microsoft...but can you imagine Bing's photos with Apple's interfaces? WOW!)

Jann

hanger

unread,
Jan 22, 2010, 5:35:04 AM1/22/10
to phonegap
Hi !
The current attached code map.h & map.m doesn't solve this issue.
A quick search on google didn't give me more answers.
You could try to post a comment here :http://blog.objectgraph.com/
index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/
That's the place where I found most informations ..
ReverseGeocoding seems easy to setup .. (long/lat -> city,country )

An alternative is to use the google map api with something like :

php:
$rep=file_get_contents("http://maps.google.com/maps/geo?q=$pcode&gl=
$country&key=GMAPAPIKEY");

I let you translate it in javascript/json

That allow you to get an array of long/lat that you can insert into
the generated mapkit map.

And "ass" said before in this thread that "localhost's dont need a
gmap api key"

On 01/22/10 11:03, venky wrote:
> Hi hanger,
>
> m working with mapkit and able to launch map with jqtouch thread.
> Just wanted to know is there anything like AJAX local search which is
> typically used with google maps API so we can do a search on map in
> mapkit...
> Bear with my english its not perfect.
>

hanger

unread,
Jan 22, 2010, 5:38:20 AM1/22/10
to phonegap
sorry misstype "ass" -> is "ade" .. sorry "ade" ;-)
Reply all
Reply to author
Forward
0 new messages