0

Can an Android app be made to continue playing sound (or play sounds based on certain location or camera based events, like "you are at such and such coffee shop", or "camera detects a car", etc.) while the device is locked?

I am aware of https://developer.android.com/training/tv/playback/options, but it's deprecated and I can't find a viable substitute or a decent explanation as to any potential workarounds.

Thank you

P.S. This is still in conceptual/research stage, so I have no code that I can share :(

10caret100
  • 11
  • 1
  • Doing anything in the background with the screen off seems to become more and more difficult in each new Android version, but at least this used to be possible. Just use a Foreground Service. – Markus Kauppinen May 27 '19 at 07:47
  • Thanks, @MarkusKauppinen. Is this a reliable way of achieving the stated goal, based on your experience? Any potential "gotchas" that will prevent the sound from being played reliably when the device goes into a "locked" state? – 10caret100 May 27 '19 at 07:56
  • I've actually tried with TextToSpeech and not with the latest Android versions, so can't say. – Markus Kauppinen May 27 '19 at 09:09
  • I think you have to use forground service – taha May 27 '19 at 10:18
  • MarkusKauppinen, taha - thanks! – 10caret100 May 28 '19 at 06:47

0 Answers0