Can I stop Android from killing my application?

I could not find a good application for streaming MP3 files from a URL that can run in the background that meets my requirements, so I decided to write it myself. It turns out it's incredibly easy to transfer MP3s with native MediaPlayer if you use Froyo or better, and I do.

But my problem is that I switch applications and try to save the stream (some of them last 2-4 hours) and play a game or something while I listen to it, sometimes it just dies. I am not sure what the problem is, I assume that the Android system decided that it was normal to kill this process ... but it is not.

So what can I do to kill other processes if I need resources instead of my streaming mp3 application?

What I tried:

android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO);

But this is not good.

+5
source share
5 answers

I found that after my Droid Incredible was upgraded to Gingerbread (2.3.4), it suddenly works. I have not changed anything, he just does not die in the Gingerbread, as in Froyo. I know that media player improvements have appeared in Gingerbread, so I will have to assume that an error occurred in Froyo that was fixed in Gingerbread.

+2
source

, . , Android , .

startForeground()

+8

, , - . , , - . .

0
0

I had problems managing memory on my Android phone that completed the processes you described. You might consider installing a program, such as Android Booster , to control the available memory and close programs that use too much memory, so that the programs you would like to keep open enough memory to run.

-2
source

All Articles