Answer the question
In order to leave comments, you need to log in
How to implement control of a third-party music player through your Android application without root?
Task: There is an application with activity, it is necessary that after 60 seconds (Timer and TimerTask are already done) music playback in any player is paused
. I'm only interested in pausing
Answer the question
In order to leave comments, you need to log in
KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PAUSE);
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
intent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
sendOrderedBroadcast(intent, null);
keyEvent = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MEDIA_PAUSE);
intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
intent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
sendOrderedBroadcast(intent, null);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question