After using my android phone for a while, it will run into this problem. In short, I am no longer able to start playback of media files (this includes custom ringtones, alarm sounds, etc). When I try to play a media file, prepare
will return status=-17
. My research so far indicates, that this happens when too many MediaPlayer 开发者_运维百科instances are active at once, i.e. other apps do not call release()
.
I am wondering, if it is possible to create a program, that can help me fixing this problem, without rebooting the phone?
Unfortunately not: there is no method to list/access all MediaPlayers that have been created but not released. Best policy (as @Saurabh noted) is to release any MediaPlayer instances you create once you are done with them to prevent resource leakage of the kind you are experiencing.
Sadly, if you are not responsible for the code that is leaking MediaPlayer instances then your best bet is to not use the apps that are leaking. Otherwise, you will need to reboot on a regular basis.
精彩评论