Hi, I am trying to put together a small music player (it should play just some app-embedded music).
My biggest problem is that I have it to keep playing music either when the phone is locked, so that the user can put his phone inside a pocket without worrying about touching the screen (and saving up some battery).
Basically I think I just need to avoid "app-pause" and "app-resume".
I tried searching the forum, but couldn't find anything useful or related to my scenario.
Could someone please share some advice?
thank you very much
P.
Comments
So which OS would you want to support? IOS, Android, both?
Thank you
In the AppDelegate.m file, just before the end of:
Note this is different to the use-case as specified in the original question. Under iOS, you can't keep the app "awake" after lock screen. However, you can specify certain services to continue after lock screen (such as music.) For such cases, you need to configure your app for the specific service.
In the case of music, this answer by gabriel_vincent on Stackoverflow works fine:
http://stackoverflow.com/questions/8926107/continue-audio-playback-when-iphone-is-locked-like-ipod-app
- Ian
http://stackoverflow.com/questions/16336960/android-playing-music-in-background
And then create Gideros plugin to communicate with this service
@ianchia http://docs.giderosmobile.com/reference/gideros/Application/setKeepAwake#Application:setKeepAwake :-\"
- Ian
@ar2sawseen I'm lucky I don't need to pass play/pause ext/prev controls to the app, the app should just "play in loop some embedded WAVs". I'm sorry if I wrote the question in the wrong way.
What I would need is to keep the application running even after locking the screen (as an example take any music player: if I have it playing something and I lock the screen, it still continues playing).
I already tried application:setKeepAwake, but I'd say it's not doing exactly what I need - unless there is a smarter way to use it than the one I used it ( I just put it at the beginning of main.lua).
In my test on the android gideros player, " application:setKeepAwake(true)" keeps the application running while the phone is unlocked (it "removes" the screen timeout, and the app is actually still running even with no interactions) but it doesn't keep the app "alive in background" if I manually lock the screen.
Didn't tried it in a compiled apk, but I suppose it would behave the same.
I still need to dive into android native development, am I right?
I tried googleing around but I'm not even sure on what to look for... If only I could find something I would give it a try, but I am afraid it would be far out of my comprehension/skills
Thank you!