This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"key_events": { | |
"key_unknown": "adb shell input keyevent 0", | |
"key_soft_left": "adb shell input keyevent 1", | |
"key_soft_right": "adb shell input keyevent 2", | |
"key_home": "adb shell input keyevent 3", | |
"key_back": "adb shell input keyevent 4", | |
"key_call": "adb shell input keyevent 5", | |
"key_endcall": "adb shell input keyevent 6", | |
"key_0": "adb shell input keyevent 7", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Took forever because of crappy tutorials, for example https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowserservice.html | |
// Key information was in COMMENTS in MediaButtonReceiver.java | |
// The key is to have a receiver with filter android.intent.action.MEDIA_BUTTON AND in the service | |
// register pending intent to the button in notification | |
builder.addAction(new NotificationCompat.Action( | |
R.drawable.ic_skip_next_black_24dp, getString(R.string.skip_next), | |
MediaButtonReceiver.buildMediaButtonPendingIntent(this, PlaybackStateCompat.ACTION_SKIP_TO_NEXT))); | |
// manifest changes |