I have an activity in my android app that starts a service and it also reacts to button presses. I have a mediaplayer that is instantiated and running in the android service. the plan is to take the button press event in the activity and transmit that information to the service that is running media player in it. That way the pause button press will send the button press event info to the service and in the service the pause method for media player will be called.
Two ideas I can think of now, the first is create a broadcast receiver class and register the button presses in that class and send them to the service with an intent extra. the second idea is to make a nested anonymous inner class of the broadcast receiver type and handle that inside of the service.
What is the best way to do this?