Search code examples
iosaudiouilocalnotification

UILocalNotification sound in silent mode


I want play the sound of local notification even if the phone is in silent mode, i have refereed this link for playing the push notification sound in silent mode.

I want to know, can we do the same for the UILocalNotification also?

Thank you!


Solution

  • There are Local Notifications, allowing apps to play an alarm sound at a specified time. But other than that, local notifications are of very limited usefulness to a sophisticated alarm clock app:

    1. A local notification does not wake up the app unless the user interacts with it, giving the app no control when the alarm sounds.
    2. Alert sounds have a maximum duration of 30 seconds and there is no way to repeat them automatically. (An app could schedule multiple local notifications in pre-defined time intervals to simulate a repeating alert, though.)
    3. Local notifications cannot override the ring/silent switch or the device’s Do Not Disturb setting.
    4. Alert sounds must be located in the app bundle. Users cannot specify a song from their music library as their alert.
    5. Apps have no control over the volume of a local notification’s alert sound (for example, to slowly crank up the volume of the alarm).

    Reference Link : http://oleb.net/blog/2014/02/alarm-clock-apps-ios/