top

How to register / unregister keys properly?

Published 2014-10-28 | (Compatible with SDK 5.0,5.1 and 2014 models)

Proper implementation for registering and unregistering specific remote keys.

Source Files

Note

The files needed for the sample application are here.

Registering / Unregistering Keys

If the functions registering or unregistering keys do not work in your application, the most probable cause is a timing issue. In order to make sure that all keys are registered in a proper way.

You can find some example code below:

  1. In index.html file:

    <script type="text/javascript" src="$CAPH/1.0.0/caph-level1-unified.min.js"></script>
    <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>
    
  2. In Main.js file:

    var PL_NNAVI_STATE_BANNER_VOL = 1;
    
    window.onShow = function(e) {
        var NNaviPlugin = caph.platform.dtv.Device.plugin('NNAVI');
        NNaviPlugin.SetBannerState(PL_NNAVI_STATE_BANNER_VOL);
        caph.platform.dtv.Device.unRegisterKey(caph.platform.Key.VOL_UP);
        caph.platform.dtv.Device.unRegisterKey(caph.platform.Key.VOL_DOWN);
        caph.platform.dtv.Device.unRegisterKey(caph.platform.Key.MUTE);
        ...
    }