I created a MediaPlayer
class to play mp3 files. Everything was fine, then my player stopped playing while it was in background and I found out that my problem was I did not create it in a service, so I started to read about services to learn how to create one and use it for my player.
My question is, what is the best way for me to communicate between the service and my application? Should I use the message or send intents or bind it?
I should also create a UI in notification area, also to show the progress buffering. Do I create a listener from the service side to the activity or there is better way?
I used these examples to learn but I did not learn how to use the onBind method yet:
- Example: Communication between Activity and Service using Messaging
- http://www.sapandiwakar.in/technical/tutorial-how-to-manually-create-android-media-player-controls/
Thanks in advance.
EDIT : I need to sometimes ask the player to send me the track details which is playing, and the player to tell me the buffer updates so i can update seek bar. Do I keep sending intents to players or should I use IBinder ?