Alarmy app can play iTunes song from background ... How?

I spilled all the documentation regarding the background state and audio playback permissions in iOS, and I can't figure out how a particular application can seem to wake itself up at a certain time in the future and play in unpacked sounds. I consider the problem because I would like to add this functionality (like many others that I saw) to the application that I am creating.

In this case, the application "Alarm" - before "Sleep, if possible." This is an alarm clock. Unlike most other alarms in the app store, it can play an iTunes song as a sound, without being in the foreground. He can bypass the ring / silent switch, increase the volume to maximum and play a pre-selected song from the local iTunes library when it looks (or should be) in the background.

I don’t know how to find out what Alarmy is doing in anticipation of the alarm time, but I see that it has turned on location services, turned on cellular data and updated the background update. However , even if they are all disabled in the settings, the alarm clock still works and plays the iTunes song! I must also assume that Alarmy does not play silence until there is an alarm time, t went through the Apple submission process (or they could just skip this and the playing field is now completely uneven).

It has a feature that seems a little out of place - the app displays weather information. This is not necessarily complete fluff - I see some value with regard to the application for the alarm clock - but is it possible that they request some weather API for short periods of time so that the application wakes up in the background before the moment of alarm? If so, what does it look like? In addition, weather APIs can use up to a certain number of requests, but they have many downloads and I accept many requests. For a fixed price paid application without IAP, this doesn't seem like a great business model.

, IMHO, , , ( ); - / ( ), - , . , , , , iOS ?

: , , ? ...

! ! - , , - , , . , .

+4
2

, info.plist. "NoSound.mp3" , , . " ", AppStore.

, , .

+4
if ([[MPMusicPlayerController iPodMusicPlayer] playbackState] == MPMusicPlaybackStatePlaying)
{
       NSLog(@"yes itune Player Sound is on");
}
else
{
      NSLog(@"NO itune Player Sound is not on");
}
+2

Source: https://habr.com/ru/post/1534720/


All Articles