How can i keep my app running in the background when the screen goes to sleep?

2,233 views
Skip to first unread message

aaor...@gmail.com

unread,
Jun 11, 2014, 3:30:29 AM6/11/14
to mitappinv...@googlegroups.com
I am creating an app which plays an audio (Player).
How can i keep my app running in the background when the screen goes to sleep? 
Acording to an advice http://puravidaapps.com/countdown.php the videoplayer (1x1) don't prevent an app from a stop. 
A notifier don't allow to switch off an screen - so a phone quickly looses an energy. 

Peep Prants

unread,
Jun 11, 2014, 6:24:56 AM6/11/14
to mitappinv...@googlegroups.com
You can use WebViewer + html5 Audio tags.



It play audio streams and mp3 files.
Audio (mp3) files you find in left upper corner :)
Also it can play backround and also "STOP" audio if call come in.
In mobile device Autoplay is disabled, that mean you need press PLAY when app start.

aaor...@gmail.com

unread,
Jun 11, 2014, 10:15:48 AM6/11/14
to mitappinv...@googlegroups.com
I don't understand how to use WebViewer + html5 Audio tags in MitAppInvertor. Can you explain?

Peep Prants

unread,
Jun 11, 2014, 1:21:09 PM6/11/14
to
I made test file for you. It works OK in my LG G2 (KitKat 4.4.2)

It contain simple html file what play audio stream this shoutcast station: http://www.chilloutradio.tk/

audio.aia

aaor...@gmail.com

unread,
Jun 11, 2014, 2:36:58 PM6/11/14
to mitappinv...@googlegroups.com
Thank you for this solution, but it doesn't suit to me, because I want that my app doesn't sleep as I want to have active the GPS and the app should make some work.. not only play audio.

Taifun

unread,
Jun 11, 2014, 2:48:06 PM6/11/14
to
you probably can do it with SL4A http://puravidaapps.com/countdown1.php
Taifun

Peep Prants

unread,
Jun 11, 2014, 3:03:29 PM6/11/14
to mitappinv...@googlegroups.com
You ask: "I am creating an app which plays an audio (Player).
How can i keep my app running in the background when the screen goes to sleep? "

You can try my solution, if screen go sleep, audio still play. If You push "Home" button Audio still play.

Taifun

unread,
Jun 11, 2014, 3:15:25 PM6/11/14
to mitappinv...@googlegroups.com
@Peep: great solution! other people most probably will find this very useful!
Taifun

nandariz...@gmail.com

unread,
Jun 12, 2014, 7:36:12 PM6/12/14
to mitappinv...@googlegroups.com
how we put those codes to appinventor panel?
can u make a tutorial for this? thanks! :D

Taifun

unread,
Jun 12, 2014, 7:41:41 PM6/12/14
to mitappinv...@googlegroups.com
you can find a lot of examples, which use an embedded HTML/JavaScript file here http://puravidaapps.com/tutorials.php#html
Taifun

Rajanikant Chandwadkar

unread,
Jul 22, 2014, 10:29:46 PM7/22/14
to mitappinv...@googlegroups.com
Why am I not able to install your app on play store?? It says "This app is incompatible with your device." My phone is Lenevo A369i and android version is 4.2 Jelly Bean.

Peep Prants

unread,
Jul 23, 2014, 11:54:53 AM7/23/14
to mitappinv...@googlegroups.com
Hi,

I`m not see Lenovo A369i Google Play supported phone list. There is with similar Lenovo`s A360, A360t, A360e and A366t.
Sorry, I can`t add you phone if google not support this :(

Regards
Peep

Richard Nero

unread,
Jan 24, 2015, 2:04:57 AM1/24/15
to mitappinv...@googlegroups.com
Peep/Taifun 

This is great solution. Peep, Installed your app as well, Looks great. 5*****

How did you auto start playing after loading - in your app. 
Is it possible to add external buttons for Play,Pause,volume. 

Do I need to create 1 html file each station or is there way to make list of audio source and somehow modify html file. 

Thank you for your help.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages