How to catch keypress on Remote Control in the background App or in the Service

hello, I need to somehow catch keypress on Remote Control in the background. It works in the foreground:


document.addEventListener("keydown", function(event){
	var keyCode=event.keyCode;
	console.log("keyCode",keyCode);
},false);

Is it possible to do it in an App or using a Service?

You can call the service in the event listener and pass the keycode from the app to service. Thank you.

1 Like

Thank you for your answer! Yes, I know, but I need to catch the keycode while HDMI is used and the App or Service is working in the background.

Basically, the app is caller and the service is callee. JS services cannot be used independently.

1 Like

Sorry, maybe I am confusing you, let’s forget about the service. Сan the App get keypress in suspended mode?
Imagine the situation, the App is running in the background and the input is HDMI, after the user clicks the button on the Remote Control, the App should take a screenshot and show it.

Unfortunately, this is not possible. When an app is in the background, it is suspended and does nothing until you bring it to the foreground. When a TV input is in the foreground, your app or service cannot capture user input. And currently, TV screen capture API is not provided. Sorry for not being helpful.

1 Like

Thanks, for the answer, you saved me a lot of time in researching. Is there any chance that the Signage library support it?

This forum is only for webOS TV apps. If your app is for webOS Signage, please contact webOS Signage Developer Support. Thank you.