Why MediaPlayer does not block UI thread?

Viewed 110

I am doing some tests about Service and I find that when I do a heavy task in Service, it will block the UI thread, but when I start MediaPlayer in Service it does not block the UI thread.

I do not know why it is not blocking the UI thread. Is it run in a background thread or something else?

1 Answers

Normally MediaPlayer does not run in the background. Please note that Service itself runs in the main thread. The Service can be used in tasks with no UI, but shouldn't be too long. If you need to perform long tasks, you must use threads within Service or use IntentService.

Related