Alarm-ios-swift icon indicating copy to clipboard operation
Alarm-ios-swift copied to clipboard

Can't play sound when device silent

Open JoeyTawadrous opened this issue 5 years ago • 8 comments

How can I play the sound even when the device is silent and in background mode?

JoeyTawadrous avatar Nov 15 '18 19:11 JoeyTawadrous

Not possible on iOS.

etherwatch avatar Nov 15 '18 20:11 etherwatch

Are you sure? There are so many apps that can do this on iOS. Including Apples built in alarm app.

JoeyTawadrous avatar Nov 15 '18 20:11 JoeyTawadrous

Any updates?

JoeyTawadrous avatar Dec 11 '18 22:12 JoeyTawadrous

Hey folks, any idea why this is happening?

jap99 avatar Jan 19 '19 11:01 jap99

not quite sure, but I plan to rewrite this tiny app, since the current one is so naive and the local notification part is outdated, and then I will try this issue.

The main part of this app is written at about 5 years ago, mainly for me to learn swift, and in fact I don't have much interests one maintaining this one, but I think I can't mislead those who new to ios develop.

And I want to mention that Apple's built in alarm app used some private api, that we are not allowed to. If there is any alarm app in app store that can play sound when in silent mode, I'd like to know and try to find out how it works.

natsu1211 avatar Feb 21 '19 05:02 natsu1211

Not possible on iOS, any apps that are doing it are either using private API or using hacked together method that violates app store review guidelines.

etherwatch avatar Feb 21 '19 14:02 etherwatch

It's possible by sending a remote push notification, in which case iOS allows the backgrounded app to run some logic. The app then uses the background audio mode to play a sound. This doesn't work if the app is terminated, in which case you schedule local notifications as a backup. So, in summary, as far as I know: if the app is still in the background, it's possible to activate audio through a push notifications. If it's not, and the phone is on silent / DND, there's no way. You can see Alarmy doing this. One thing I didn't understand, though, and would love to hear some ideas: it seems to work even if the device is on airplane mode. How does it get the push notification? Here's the test: set the device to airplane mode. Set a new alarm in Alarmy for the next minute. Exit the app (not terminating it, just in the background).A local notification will pop up, but the alarm will continue playing (and keep the volume up even if you try to change it) even after you dismiss the local notification. How does this happen? Any thoughts? Thanks

yarivadam avatar Jun 22 '19 05:06 yarivadam

Any Update ? Can we get notification (Alarm) when phone is on silent / DND ?

Rushang007 avatar Jan 01 '24 14:01 Rushang007