2

I am trying to sync the system volume seekbar with the application seekbar.

System volume seekbar
System volume seekbar.

App volume seekbar
App volume seekbar.

I found a useful link.

Taking over the volume key on Android

Following, I am able to make my app seekbar change whenever users press the volume button.

My questions are:
1/ Is it able to sync the system volume seekbar with the app volume seekbar? I mean when users change the seekbar (not pressing the button), my app volume seekbar also changes too.
2/ If the question 1 is "yes", please show me the way. I found some links which suggest to use registerMediaButtonEventReceiver, but it is already deprecated.

EDIT

Here is what I am doing right now:
1/ I used MediaPlayer to play an audio
2/ I used AudioManager to manage the volume whenever the seekbar change
3/ I used onKeyUp and onKeyDown to detect the action pressing volume button
Thank you in advance!

Community
  • 1
  • 1
Luong Truong
  • 1,953
  • 2
  • 27
  • 46
  • see `android.support.v4.media.session.MediaSessionCompatApi8#registerMediaButtonEventReceiver` – pskink Mar 28 '16 at 04:42
  • @pskink: Can you show me how to do it. I start researching but there are not many documents which are able to solve my problem. I am also appreciated if you can leave your full answer. Thank you – Luong Truong Mar 29 '16 at 05:12
  • just like deprecated `AudioManager#registerMediaButtonEventReceiver` (the method signature is the same so it should work the same way) – pskink Mar 29 '16 at 05:41

0 Answers0