I am trying to wake application in background. I have seen one app which is waking app in background when local notification arrives. App name is Alarmy - https://itunes.apple.com/us/app/alarmy-alarm-clock/id1163786766?mt=8
I have checked apple documentation for background modes - https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
I found one hint in that to launch app in background - "For audio apps, the audio framework needs the app to process some data. (Audio apps include those that play audio or use the microphone.)" but i didn't find any technical assistance on that.
Regarding Alarmy app I found 2 or 3 questions here and all of them saying that they are playing silent sound with AVAudioSession category playback. I did try that but it's not helping me to awake app when local notification comes.
Till now i did infinite loop of silent audio and also set up audio session but it's not working to wake the app.
let audioSession = AVAudioSession.sharedInstance()
try? audioSession.setCategory(.playback, mode: .default, options: .mixWithOthers)
try? audioSession.setActive(true)
audioPlayer = try! AVAudioPlayer.init(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: "Birthday_6", ofType: "mp3")!))
audioPlayer?.numberOfLoops = -1
audioPlayer?.play()
If anyone have idea on AVAudioSession to wake the app like location services then please let me know.