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

**URL:** <https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383>\
**Category:** Web App Development\
**Created:** [January 30, 2024, 8:24pm UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383 "2024-01-30T20:24:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_falenkova](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@m\_falenkova](https://forum.webostv.developer.lge.com/u/m_falenkova)\
**Post date:** [January 30, 2024, 8:24pm UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/1 "2024-01-30T20:24:26Z")

</div>

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

```auto

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?

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [January 31, 2024, 5:27am UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/2 "2024-01-31T05:27:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![m\_falenkova](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@m\_falenkova](https://forum.webostv.developer.lge.com/u/m_falenkova)\
**Post date:** [January 31, 2024, 10:31pm UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/3 "2024-01-31T22:31:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [February 1, 2024, 12:25am UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/4 "2024-02-01T00:25:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![m\_falenkova](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@m\_falenkova](https://forum.webostv.developer.lge.com/u/m_falenkova)\
**Post date:** [February 1, 2024, 5:33am UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/5 "2024-02-01T05:33:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [February 1, 2024, 7:01am UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/6 "2024-02-01T07:01:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![m\_falenkova](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@m\_falenkova](https://forum.webostv.developer.lge.com/u/m_falenkova)\
**Post date:** [February 1, 2024, 6:16pm UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/7 "2024-02-01T18:16:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [February 1, 2024, 11:55pm UTC](https://forum.webostv.developer.lge.com/t/how-to-catch-keypress-on-remote-control-in-the-background-app-or-in-the-service/5383/8 "2024-02-01T23:55:53Z")

</div>

This forum is only for webOS TV apps. If your app is for webOS Signage, please contact [webOS Signage Developer Support](http://webossignage.developer.lge.com/common-page/contact-us). Thank you.
