Melany
Melany

Reputation: 466

Duration of UILocalNotification custom sound when app is in background is 5 seconds

I am using deprecated UILocal notifications, and use custom tracks of .caf type, the duration of the audio is 27 seconds. When device is locked and notifications arrives so the sound plays fully, but when the app is in the background mode and device is not locked, the notification appears and sound plays but just 5 seconds. Could you please advice is there any documented Apple suggestions, or why it is like that?

Upvotes: 1

Views: 75

Answers (1)

RiomoX Mouad
RiomoX Mouad

Reputation: 63

The problem is because of the Type of the notification is by default a 'Banner' (which makes the notification dismisses it self automatically after 5 seconds, which results the audio to stop), change the notification type of your app to 'Alert' (from the phone's settings) and your problem will be solved. Unfortunately i couldn't find anyway to change the notification type programmatically, only the user can change it manually from the settings (maybe use an in-app popup to ask the user to do so).

Upvotes: 2

Related Questions