Home » Android » java – Android PIP mode handle controller actions – Stack Overflow

java – Android PIP mode handle controller actions – Stack Overflow

Posted by: admin February 20, 2020 Leave a comment


I’m new to the PIP feature of Android but so far it was straight forward to implement. I just have one question is it somehow possible to handle external controller inputs when my app is in PIP mode?

I have an app which is able to stream and control games, these games can be controlled via an optional external gamepad connected via USB or Bluetooth. From what I found out in the official documentation is this

When an activity is in PIP mode, by default it doesn’t get input
focus. To receive input events while in PIP mode, use
MediaSession.setCallback(). For more information on using
setCallback() see Displaying a Now Playing Card.

But I’m not sure if this is what I need and if it can also handle gamepad events. Maybe it’s not possible at all I searched for a while now on the internet but I could not find any specific hints about external controller handling while in PIP mode. Sorry for the dumb question but maybe someone with more experience in that feature could guide me in the right direction.