I have an Android app in which the user presses buttons and a sound plays based on the button pressed (uses MediaPlayer). Now when the user gets a phone call, the sound still plays. I want to be able to detect when the user is getting a call so that I can stop the sounds and to resume the sounds when the user is not talking on the phone anymore.
I think you are looking for registering broadcast receiver for this action.