I created a MediaPlayer class to play mp3 files. Everything was fine, then my player stopped playing while he was in the background, and I found out that my problem was that I did not create it in the service, so I started reading about the services in order to learn how to create them and use them for my player.
My question is, what is the best way for me to communicate between a service and my application? Should I use the message or send intentions or bind it?
I also need to create a user interface in the notification area, and also show the buffering of progress. Am I creating a listener from the service side for activity, or is there a better way?
I used these examples to find out, but have not yet learned to use the onBind method:
Thanks in advance.
EDIT: I sometimes need to ask the player to send me information about the track that is playing, and the player to tell me buffer updates so that I can update the search bar. Do I keep sending intentions to players or use IBinder?
source share