uilocalnotification

Creating a local notification to fire at a specific time

拥有回忆 提交于 2021-02-08 09:51:13
问题 I need my application to store some local notifications that should be launched on a specific time. My application is simple. The user can book times using a UIDatePicker . The notification is to be fired 2 minutes before that booked time. For now i am trying to manually insert a time that the notification should be fired at. I am using this code: let notification = UILocalNotification() self.timePicked = " 22:38:00 +0000" timeForLocalPush = defaults.objectForKey("timeForLocalPush") as!

How to Set repeat interval as well as fire date in UNNotificationRequest

。_饼干妹妹 提交于 2021-02-07 18:01:18
问题 Previously I am using UILocalNotification for reminder purpose in my application. But as above API is deprecated in iOS 10.0 now need to use UserNotifications Framework's UNNotificationRequest . Using UILocalNotification i was able to set fire date as well as repeat interval as below: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; NSDate *tomorrow = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:[NSDate date]]; localNotification.fireDate = tomorrow; if

How to Set repeat interval as well as fire date in UNNotificationRequest

自作多情 提交于 2021-02-07 18:00:25
问题 Previously I am using UILocalNotification for reminder purpose in my application. But as above API is deprecated in iOS 10.0 now need to use UserNotifications Framework's UNNotificationRequest . Using UILocalNotification i was able to set fire date as well as repeat interval as below: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; NSDate *tomorrow = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:[NSDate date]]; localNotification.fireDate = tomorrow; if

How are some alarm apps such as Alarmy able to play a sound on iPhone when the app is in the background and the phone is on vibrate

送分小仙女□ 提交于 2021-02-06 15:16:30
问题 I am working on app that can alert users for some critical things. I use local notifications to alert the user. On iOS, I find that the notifications will not ring if the phone is on vibrate. This is a deal-breaker for many users of the app but I have been putting that question off till now since I thought that iOS doesn't allow an app to play a sound if the app is in the background. Music apps are able to play songs even when the phone is on vibrate by enabling the audio background mode but

How are some alarm apps such as Alarmy able to play a sound on iPhone when the app is in the background and the phone is on vibrate

孤者浪人 提交于 2021-02-06 15:14:45
问题 I am working on app that can alert users for some critical things. I use local notifications to alert the user. On iOS, I find that the notifications will not ring if the phone is on vibrate. This is a deal-breaker for many users of the app but I have been putting that question off till now since I thought that iOS doesn't allow an app to play a sound if the app is in the background. Music apps are able to play songs even when the phone is on vibrate by enabling the audio background mode but

How are some alarm apps such as Alarmy able to play a sound on iPhone when the app is in the background and the phone is on vibrate

五迷三道 提交于 2021-02-06 15:11:21
问题 I am working on app that can alert users for some critical things. I use local notifications to alert the user. On iOS, I find that the notifications will not ring if the phone is on vibrate. This is a deal-breaker for many users of the app but I have been putting that question off till now since I thought that iOS doesn't allow an app to play a sound if the app is in the background. Music apps are able to play songs even when the phone is on vibrate by enabling the audio background mode but

Action from local notification not working in iOS 13

核能气质少年 提交于 2021-01-29 19:34:12
问题 I am using local notification using the UserNotifications framework in which I have two action buttons. Now I want to perform one task upon selecting that action button. My query is whether I need to run this task in the background? As I am sending this local notification based on geofence triggering when my application is not even running and in a killed state. Configure User Notification Center localCenter.delegate = self localCenter.requestAuthorization(options: [.alert, .badge, .sound]) {

Send a local notification when timer is up

北慕城南 提交于 2021-01-29 07:49:41
问题 I would like to send a local notification once 24 hours has passed after a button is selected. The button is currently only enabled once 24 hours has passed and the waiting time is saved in UserDegaults. I would like to know how I will be able to send a local notification to the user automatically once the 24 hours has passed. func getNextQuote(){ let defaults = UserDefaults.standard defaults.integer(forKey: "savedIndexKey") let currentIndex = defaults.integer(forKey: "savedIndexKey") var

stop audio while in background

谁都会走 提交于 2021-01-27 14:40:29
问题 There is an app called IHeartRadio which lets you set a sleep timer which will shut off audio after a specified interval. You first choose a station to listen to and then select an amount of time to sleep after which the radio station will stop playing. The app does not need to be in the foreground for this to happen. How is it possible for an app to stop audio while it is in the background? One theory was to set a UILocalNotification with silent audio. Then the UILocalNotification would take