Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Local Push Notification Override Mute/Silent Mode

I am currently working on an iOS project that requires me to send a local push notification to a user with a sound. The issue is that I want the sound to play even if the device is muted or in silent mode, but I am not sure if this is possible.

There have been a few similar questions but none of them have been answered successfully like this: iPhone - Is it possible to override silent mode or have a recursive alert sound with push notification?

Disclaimer: I understand this is not a desirable feature for an app and that it might be cause for rejection from the App Store.

like image 377
Alex Grinman Avatar asked Nov 12 '11 02:11

Alex Grinman


People also ask

Can an app override silent mode iOS?

Unfortunately, most incident alerting applications are unable to bypass or override the iPhone mute button, preventing on-call persons from receiving audible, mobile notifications for time-sensitive issues.

What is silent push notification in iOS?

Silent push notifications are simply notifications that mobile app users receive without any pings, alerts, or interruptions to the user. They arrive on the mobile device and sit in the notification tray until read or dismissed.

What is notification service extension?

A notification service app extension doesn't present any UI of its own. Instead, it's launched on demand when the system delivers a notification of the appropriate type to the user's device. You use this extension to modify the notification's content or download content related to the extension.


1 Answers

I just found this question while searching something related to push notification..

You can achieve it by listening to the push notification and start playing a sound within your app when receiving the push notification

1) for iOS7 and above, you can get the push notification even user doesn't open the app by using this method

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;

2) inside the method, you can let your app to start playing a sound file. You may need a bit extra work to configure your AVAudioSession to allow your sound to play even when the device is in silent mode. you can check the documentation for more details - it's gonna take some time to appropriately handle the audio.. you have to consider situations where other app is already playing sound or sound output from different channel e.g. speaker, earphones etc.

like image 143
xialin Avatar answered Oct 03 '22 07:10

xialin