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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With