ios setting to neatly bypass iphone mute - ios

I am working on an app that, among other things, provides alarms in emergencies. I would like to add a setting that will allow users to receive alarms with sound even if their phone is muted. As far as I am aware, this could be hacked by playing an mp3 through media services, as if the app was a music player left to play in the background, but that doesn't seem extremely kosher.
Does anyone know a 'neater' way to do this? Can I somehow allow my users to prioritise my app over the mute button?
Thank you very much.

Related

Is it possible to detect music controls

I have a side project playing with some music controls on my iPhone. I know that i can detect volume up/down keys or track changes for Apple music app. Does anyone know if this is also possible to do for any other music apps like Spotify?
You can use the MPRemoteCommandCenter to detect the controls. I'm not sure if it will work with Spotify but it's definitely worth a shot.

How to hide default interface(rewind and volumn button) on lockscreen when app is playing no-sound aiudio on background

To achieve my goal,i need to play no-sound audio when users put my app into background.However,i don't want users to know that the app is playing no-sound music on background.But the interface(rewind and volumn buttons)on the lcokscreen can be deceived by users.Therefore,i am searching a method to hide them? I don't want to talk about whether my app will be refused by Apple or not, i just want to hide default interface on lockscreen. It is really appreciated if somebody can help me.

How to play UILocalNotification sound while do not disturb mode is on?

I can't seem to find a way to play the local notif sound when do not disturb is on, it's for an alarm clock app so it's kind of essential that the sound play even when do not disturb is on. Is there anyway around this?
As another option I've considered having a blank audio play in the background until I need the alarm called, but I've heard that Apple would reject this method.
Why would you need to play when the phone is in do not disturb mode? Chances are that if the user wanted to hear the alarm they would disable the do not disturb mode. I don't think there is a way to get around your problem.

Using the TTS Synthesizer in iOS when the app is ALREADY on the background

I would like to play a sound and use the AVSpeechSynthesizer to speak out some strings. The point is that I want these to happen when the device is already locked and then some events happen which triggers them.
I've found lots of info about how to play sound on the background, but this means that playback starts when the app is active and then the playback could continue, if the screen is being locked (after the start of playback). I've done all the tricks but can't hear a sound, which is triggered when the device is locked (and app is already on the background). However this works with iOS 8.3 simulator almost out-of-the-box, but not with a device.
So how to resolve this? Should I actually use some notification stuff to produce the desired outcome? I'm not too familiar with the notifications, so is there any other workarounds or is the notifications way easier than I think?
Cheers,
Mikko

Phonegap media stops system music

Phonegap media play method has a magic option playAudioWhenScreenIsLocked = false that does good job:
Prevents app music from playing when app is in background;
Makes app music obey the hardware "mute" button: without this option your app will ignore if user device is muted and play sound anyway.
But there is third hidden magic in this option. It stops current playing song from native Music app. Most of all it's annoying when I want to play short single sound.
Actually I would like to implement this scenario:
Music: Check if system music is playing on the app start. If it is not, play my app music, otherwise let user enjoy his own media.
Sound FX: Just play my little sound once and don't spoil anything.
And never play anything in background and when device is muted! Even if system Music app can let itself do so.
Has anyone managed to do something similar?
Thank you.
Ended up using https://github.com/floatinghotpot/cordova-plugin-nativeaudio (https://build.phonegap.com/plugins/2291)
Be aware: simple sound effects are not working in Simulator.

Resources