Reputation: 2592
I am building an application where i show the bus stops on the map and the user current location as well.I want to implement the notification that when the user is say x meters from one bus stop ,there should be a notification like alert,sound .So that he can prepare for his stop.There may be many stops on the map and i want to do it for everystop. Please help me how to implement that.Whether it would be LocalNotification,Then how to use this in this way..........
Thanks in advance
Upvotes: 1
Views: 449
Reputation: 26390
Do all your distance calculations in didUpdateToLocation
.
You can send local notifications in iOS 4, using UILocalNotification class.
Here is some sample code:
UILocalNotification *noti = [[UILocalNotification alloc] init];
noti.fireDate = someDate;
noti.alertBody = someText;
noti.alertAction = nil;
noti.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:noti];
[noti release];
Make sure the date is as close as possible as [NSDate date], so it will appear right away.
Upvotes: 2