Forum Replies Created
Have you tried setting your audio session category to “AVAudioSessionCategoryPlayback”?
That works for me. My app also has the location and audio flags for background execution set in plist.
Both GPS and Flite continue to work for me with the screen locked.
The problem I had was that my app was rejected because the “plays background audio” flag was set and my app did not play background audio. Flite doesn’t count as background audio. I had to add background audio to my app in order for it to be approved.
After more reading in the IOS Library, I set the audio category for my app to “AVAudioSessionCategoryPlayback” and also set the override switch to allow mixing with other applications. The background modes for both audio and location are set in my plist. Now my app works in background mode and will even continue to work when music is playing in the background as well. So, Flite will indeed run in background mode.
Just for fun, I did another test with VOIP at the 3rd position in the array even though it doesn’t apply for my app. I this case, the GPS method runs, but the Flite speech initiated from it does not. However, Flite speech initiated from a button continues even after the screen is locked. I wish that I could find out exactly what happens when the various background modes (audio, location, voip) are set. Do you know of any documentation on this?
Thanks for your help..
Thanks for the reply. I’ve tried that and it seems only one or the other works for my app. If I set GPS as the first item in the array and audio as the second, then GPS will work with the screen locked, but not Flite. However, if audio is in the first position of the array, then Flite works but not GPS. In the GPS method “didUpdateToLocation”, which runs when there is a GPS location update, I compute max speed and also when speed exceeds various thresholds, I use Flite to speak the speed. I can tell if GPS runs under screen lock if top speed gets computed. With GPS first in the array, I get max speed computed with the screen locked, but no Flite speaking. I can also test Flite by pressing a button. When I do this to start Flite speaking, then press the screen lock, if audio is set first in the array, the speaking will continue after the screen is locked. However, if GPS is first in the array, then the speaking will cut off when the screen is locked and continue when unlocked. Any idea why the GPS and audio cases seem to be mutually exclusive for my app?
I have a GPS/TTS (Flite) app that I would like to get working in the background. The app uses Flite to speak GPS values like speed. If I set the “Required background modes” to “App registers for location updates” (i.e. one of the three cases for background operation) then the GPS part of my app continues to work in the background, but Flite does not. Is there any way to get Flite to work in the background?