开发者

How to provide the Notification in iphone.(GPS Notification)

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 s开发者_C百科ay 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜