0

Audio should continue playing even if device is locked.But it should not play when app goes to background mode. Is this possible. I tried setting in info.plist but app plays in background mode as well as if device is locked.Can't i achieve only the case of device locked scenario.

Kalaivani
  • 424
  • 4
  • 20
  • try this option :- http://stackoverflow.com/questions/22591421/ios-background-audio-not-playing – Mitul Marsoniya Feb 22 '16 at 09:16
  • @mitul. Thanks for the link.All those answers are for making app to play sound in Background but for me it should not play in background whereas it should play only when device is locked.Any help? – Kalaivani Feb 22 '16 at 09:21
  • refer https://developer.apple.com/library/ios/qa/qa1668/_index.html and http://stackoverflow.com/questions/10429204/how-to-handle-background-audio-playing-while-ios-device-is-locked-or-on-another – Rince Thomas Feb 22 '16 at 09:27

1 Answers1

0

You register for the event when your app is moved to the background, and for the event when the app comes back to the foreground, and then you stop / start playing when these events happen.

I can't see how your users would be happy with this. If they want the sound when the device is locked, surely they want the sound when the app is in the background.

gnasher729
  • 51,477
  • 5
  • 75
  • 98