2.7 C
Canberra
Thursday, July 16, 2026

ios – Do Essential Alert (Apple) sounds play one by one, or can two overlap?


I am utilizing UNNotificationSound.criticalSoundNamed with the Essential Alerts entitlement. I’ve two separate alarms that may every be lively on the similar time, every scheduling its personal native notification on a repeating timer.

Earlier than switching to essential alerts, I performed these with two AVAudioPlayer cases, they usually overlapped advantageous. Now, utilizing essential alert notifications as a substitute, just one sound performs at a time — even when each are triggered across the similar time.

Is that this anticipated? Does iOS solely ever play one essential alert sound at a time per app (or system-wide), or is there a strategy to get two to play concurrently?

Code Snippet under:

Issues to notice: UNUserNotificationCenter is a real singleton – from what I learn on-line…so in principle the completely different “sounds” or audio clips will compete to play – inflicting a ruckus – and that is what is definitely taking place.

I wished to know if there’s a work-around for this, or I ought to simply resort to selecting one sound to play at a time.

non-public func scheduleCriticalMotionNotification() {
        let ids = Self.motionNotificationIDs
        let scheduleID = nextMotionNotificationIsA ? ids[0] : ids[1]
        let previousID = nextMotionNotificationIsA ? ids[1] : ids[0]
        nextMotionNotificationIsA.toggle()

        let middle = dependencyContainer.notificationModel.notificationCenter
        middle?.removePendingNotificationRequests(withIdentifiers: [previousID])
        middle?.removeDeliveredNotifications(withIdentifiers: [previousID])

        let content material = UNMutableNotificationContent()
        content material.sound = .criticalSoundNamed(UNNotificationSoundName(rawValue: "idle_alert.wav"), withAudioVolume: alertVolume)
        content material.interruptionLevel = .essential
        content material.userInfo = ["ind_alert_kind": "one_to_one_motion"]

        let set off = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false)
        let request = UNNotificationRequest(identifier: scheduleID, content material: content material, set off: set off)
        middle?.add(request) { error in
            if let error = error {
                print("❌ Error scheduling essential no-movement alert: (error)")
            }
        }
    }

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles