Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why just first 5 seconds of UNNotificationSound plays

After updating to iOS 10.1.1 the iOS Notification custom sound stop after 5 seconds.

This happens only if device is turned on, but it plays whole 30 seconds if device is off.

The UNNotificationSound documentation says:

You can package the audio data in an aiff, wav, or caf file. Sound files must be less than 30 seconds in length. If the sound file is longer than 30 seconds, the system plays the default sound instead.

https://developer.apple.com/reference/usernotifications/unnotificationsound

So if we're able to set 30 second sound files, then there must be a way of allowing them to play for 30 seconds not only 5?

like image 950
AVEbrahimi Avatar asked Nov 19 '16 05:11

AVEbrahimi


1 Answers

Notifications last no longer than 5 seconds when the device is unlocked, by default. You can't change this behavior programmatically. But the user can change the Notifications settings for the app, so banners will not hide after 5 seconds. She need to set Banner Style to Persistent. This problem was successfully solved in Periodic Timer + app.

like image 147
kelin Avatar answered Sep 23 '22 12:09

kelin