I am developing an audio record application in android. So if any background music is already playing in the device music player, that should be paused before it starts recordin
get audioManager and check
audioManager.isMusicActive()
if true
private void toggleNativePlayer(Context context) {
Intent intent = new Intent("com.android.music.musicservicecommand");
intent.putExtra("command", "togglepause");
context.sendBroadcast(intent);
}
and after you finish recording run this code again to start play musig again