application xamarin android that can handle commands from remote

I have android tv box, and I have a remote with numbers
I want to try making an application, which can handle all the numbers in my remote
such as press 1, then the "youtube" application will open,
such as press 2, then the "xplore" application will open,
such as press 3, then the "file manager" application will open,

like the thing, press the home button on Android, it will return to home
I want to make it like that, if you press the number you want, then the application you are going to will open

when pressing 0, it will return to the application we made, to change the settings (number = application)

like "adb getevent -lt"
when there is a keyevent it will respond to the button that is pressed

I want to code like this:

    public override bool OnKeyDown(Android.Views.Keycode keyCode, Android.Views.KeyEvent e)
    {
        if (keyCode == Android.Views.Keycode.Num1)
        {
            >>>> open youtube
        }
        if (keyCode == Android.Views.Keycode.Num2)
        {
            >>>> open xplore
        }
        if (keyCode == Android.Views.Keycode.Num3)
        {
            >>>> open file manager
        }
        if (keyCode == Android.Views.Keycode.Num0)
        {
            >>>> open my app
        }
    }

Such code only applies, when my application is on display
when another application is on the screen then "OnKeyDown" not applicable

anyone can help me so that my application "OnKeyDown" can work on the background???

drivegooglecom/file/d/11q6e3VNuoAGYZShinSYj8iJ4X7TiBY9v/view?usp=sharing

Tagged:
Sign In or Register to comment.