question

Jon R. Helms avatar image
Jon R. Helms asked

Keypressed duplicated to home screen?

When testing my app on Fire TV sometimes I heart Radio will start playing in the background even though I had left it in a stopped state. It's almost like the keypresses to my dev app are being sent through to the home screen and then into other apps. I've had this happen several times, but it doesn't always happen. I haven't seen this happen unless I am in an app loaded through ADB. I also haven't see the effect with anything except IhR as the other app. I just now got it to happen when my app was playing a video with VideoView and I pressed the forward key which did advance my video but also kicked on a radio station in IhR. I don't know if this is a bug with development mode on Fire TV, a bug with IhR, or something in my app, but I never see behavior like that with my app on my phone or tablet and it's the same code. Any thoughts?
fire tv
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jon R. Helms avatar image
Jon R. Helms answered
I just made it happen by pressing the fast forward button or play button on the home screen, but I can't make it happen in Netflix, so I'm guessing there is something that can be done to disrupt or temporarily suspect IhR's button capture. Any ideas? This isn't isolated to my app, but Netflix figured it out there has to be some way to deal with it and I'm guessing it's something known and expected.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jon R. Helms avatar image
Jon R. Helms answered
I found the solution to the keypress issue, I still have to stop the background music before going into my app, but registering my app to receive media button events made them not go to the background app anymore. AudioManager manager = (AudioManager) getSystemService(AUDIO_SERVICE); manager.registerMediaButtonEventReceiver(new ComponentName(getPackageName(), main.class.getName()));
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.