Monday 15 June 2015

android - Anybody experiencing ANR when using MediaPlayer as service? -


Hi, I am getting ANR (no application answer) errors but why can not I understand if I click on "Waiting" then everything works properly and ANR is not coming back now.

Now, I know that when MediaPlayer is used as a service, then preprocessor and .prepared () method instead of simple .prepare () and .start () This UI does not lock the thread and works great.

The problem is that while opening the file all my ANRs are not being done (you guess high processor there), but randomly when they are playing and when the CPU is at least % As I mentioned earlier that nothing is too close to being responsive and there is little left over the UI thread.

The only clue is that I do not have to play any track for the first time, but after only one track it has been changed. I thought that the ready threads were knocking and I did not add any changes to the lock itself.

I tried to release the media player every time before starting a new track. No change

I tried resetting, stopping etc. in many scenes. no changes.

Has anyone experienced the same thing?

As an alternative solution, is there any way to automatically dismiss ANR? I know that this is not the answer but I can not find any option I am on a Routed tablet (I compiled Rome) and this is for myself - no delivery

thanks

A standard service actually runs on the main thread, if you are looking at ANR, then you probably have the entire media player Should be taken in

Most confusions about service classes actually spill which is not it:

  • One service no is a different process .
  • No service no is a thread that does not mean it works for the main thread (no answer to errors to avoid the application)

    You are already using prepareAsync () , but as you said the error occurs when MediaPlayer is running, is not preparing . Without actually knowing more about the cause of ANR, I believe that switching to the Handler Triad is your best choice.

No comments:

Post a Comment