Hey all I have been trying to get my remotes volume up/down buttons to register in my app but they never seem to do anything when I press them?
I have tried:
and also
But like I said, every time I hit the buttons they never fire any of those above. The only ones that register are the Dpad up/down/left/right, center button and the back button.
I cam change the volume just fine using this code:
But that does me no good if I cant detect the volume up/down being pressed...
The google TV remote looks like this:
Anyone know what I am missing?
I have tried:
Java:
public class CallBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
int volume = (Integer)intent.getExtras().get("android.media.EXTRA_VOLUME_STREAM_VALUE");
Log.i("Tag", "Action : "+ intent.getAction() + " / volume : "+volume);
}
}
and also
Java:
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction()!=KeyEvent.ACTION_DOWN)
return true;
switch (keyCode) {
case 20:
return false;
case 22:
fastForward();
return false;
case 21:
rewind();
return false;
case 23:
if (mTransportControlGlue.isPlaying()) {
mTransportControlGlue.pause();
} else {
mTransportControlGlue.play();
}
return false;
getActivity().finish();
return true;
}
return false;
}
But like I said, every time I hit the buttons they never fire any of those above. The only ones that register are the Dpad up/down/left/right, center button and the back button.
I cam change the volume just fine using this code:
Java:
AudioManager mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
int actualVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 1, AudioManager.FLAG_PLAY_SOUND);
But that does me no good if I cant detect the volume up/down being pressed...
The google TV remote looks like this:
Anyone know what I am missing?