uilocalnotification

Send Local Notifications while App is running in the background Swift 2.0

假如想象 提交于 2019-11-30 14:11:27
I am trying to send the user a 'Push Notification style' Alert when the user minimizes the app (by clicking on the iPhone's Home Button or by locking the phone as well). My app continuously parses an XML file (every 10 seconds) and I want the app to continue running so that it sends the user a Local Notification once some condition has been met in my program, even after the user has minimized the app or locked their phone. I've bounced around from tutorials and everyone seems to 'schedule' a Notification, but this isn't going to work for me because my Notification isn't time-based, rather it's

iOS: showing an alert when getting a call?

▼魔方 西西 提交于 2019-11-30 10:35:23
I would like a local notification to be fired when a call is received (and to show an alert) - is this possible? Can a call event get an app to launch or a notification to be fired? How is skype fired? With push notifications? Thanks If your application is running while a call is in place check out the CoreTelephony Framework . The CTCall class provides information about the call state. I have not used this myself but you may find it useful. extern NSString const *CTCallStateDialing; extern NSString const *CTCallStateIncoming; extern NSString const *CTCallStateConnected; extern NSString const

iOS 9 : beginBackgroundTaskWithExpirationHandler is getting called before timout

大城市里の小女人 提交于 2019-11-30 09:45:50
问题 i'm working on VOIP call and adding support to iOS < 10. For incoming VOIP call when app is in background, i'm using UILocalNotification (deprecated in iOS 10). To make a call 60 secs (or 1 minute) i'm using this code count = 0; apnTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(showIncomingCall:) userInfo:userInfo repeats:YES]; self.backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{ NSLog(@"ALVOIP : BACKGROUND_HANDLER_NO_MORE_TASK

application didReceiveLocalNotification not fired iOS7

青春壹個敷衍的年華 提交于 2019-11-30 09:04:01
The problem: - (void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification is not called sometimes with iOS7. It doesn't mater how we schedule the notification: alarm.fireDate = [[NSDate date] dateByAddingTimeInterval:0.1]; [app scheduleLocalNotification:alarm]; or: [app presentLocalNotificationNow:alarm]; My thoughts: This happens in the case when the user slides before the notification alert animation is finished. And if he waits just a half second before he slides - the notification is fired and the App proceeds as expected. The problem

iOS Daily Local Push Notifications

眉间皱痕 提交于 2019-11-30 08:50:21
问题 I want to execute a UILocalNotification at 9:00 AM every day, forever, as long as the app is open. The closest thing I've found is this: UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60*60*24]; notification.alertBody = @"It's been 24 hours."; [[UIApplication sharedApplication] scheduleLocalNotification:notification]; However, this code only executes a UILocalNotification once in 24 hours, not at a

Geolocation with local notification like reminder

邮差的信 提交于 2019-11-30 07:45:52
i want implement geolocation notification like the app reminders. this is what i have already done: in App delegate: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; /* don't leak memeory! */ [self.locationManager setDelegate:self]; [self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { } And this

How to increment application badge number for recurring local notification (iPhone)

我的梦境 提交于 2019-11-30 07:37:15
I've setup a local notification that repeats every minute, however I need the application badge number to increment each time. When I run it at the moment it doesn't seem to increase, it just stays a 1. Please can someone help me out? Here is how I create the notifications: // Create the UILocalNotification UILocalNotification *myNotification = [[UILocalNotification alloc] init]; myNotification.alertBody = @"Blah blah blah..."; myNotification.alertAction = @"Blah"; myNotification.soundName = UILocalNotificationDefaultSoundName; myNotification.applicationIconBadgeNumber++; myNotification

Local notification while app not running

亡梦爱人 提交于 2019-11-30 07:27:52
Is it possible to show some kind of a local notification from an app, even if the app isn't running(also not in background)? For example a daily reminder or something like that. I know that it is possible with push-notifications, but it doesn't fit for my app. You can easily schedule local notifications, and they will be presented at the scheduled date and time regardless of the app's state. First you need to get permission from the user to present notifications, like this: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool

Scheduling local notification from within a Today extension

时间秒杀一切 提交于 2019-11-30 06:46:53
问题 I'm making an app that contains a Today Extension. The today extension displays a list of timers, and if the user selects one of the timers, I'd like to create and schedule a local notification for that timer. My problem is that scheduling of notifications is done with this line of code: UIApplication.sharedApplication().scheduleLocalNotification(notification) which very unfortunately relies on UIApplication.sharedApplication() that is not accessible from an extension. So my question is: How

iOS中使用本地通知为你的APP添加提示用户功能

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 06:43:14
iOS中使用本地通知为你的APP添加提示用户功能 首先,我们先要明白一个概念,这里的本地通 知是 UILocalNotification类,和 系统的 NSNotificationCenter通知中心是完全不同的概念。 一、我们可以通过本地通知做什么 通知,实际上是由IOS系统管理的一个功能,比如某些后台应用做了某项活动需要我们处理、已经退出的应用在某个时间提醒我们唤起等等,如果注册了通知,系统都会在通知触发时给我们发送消息。由此,我们可以通过系统给我们的APP添加通知用户的功能,并且应用非常广泛。例如,闹种类应用,有按时签到相似功能的应用。下面,我们就来介绍如何注册并且设置一个本地通知。 二、了解 UILocalNotification类 顾名思义,这个类就是我们需要使用的本地通知类,先来看它的几个属性: 设置系统发送通知的时间(如果是过去的时间或者0,则会立刻发起通知) @property ( nonatomic , copy ) NSDate *fireDate; 设置时间的时区 @property ( nonatomic , copy ) NSTimeZone *timeZone; 设置周期性通知 @property ( nonatomic ) NSCalendarUnit repeatInterval; NSCalendarUnit对象是枚举,设定通知的周期