Class KeymappingCtrl

java.lang.Object
com.unitech.api.keymap.KeymappingCtrl

public class KeymappingCtrl extends Object
This controller is used to manage the Programmable Key API.
  • Field Details

  • Method Details

    • getInstance

      public static KeymappingCtrl getInstance(android.content.Context context)
      Get an instance of the KeymappingCtrl
      Parameters:
      context - The context which will use this controller instance
      Returns:
      A KeymappingCtrl instance
    • getKeyMappingEnabled

      public android.os.Bundle getKeyMappingEnabled()
      Check if the Programmable Key service is enabled
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
      int enabled = bundle.getInt("status");
    • enableKeyMapping

      public android.os.Bundle enableKeyMapping(boolean enabled)
      Enable or disable the Programmable Key service
      Parameters:
      enabled - true: Enable, false: Disable
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • addKeyMappings

      public android.os.Bundle addKeyMappings(String keyName, String keyCode, boolean wakeup, String broadcastDownAction, android.os.Bundle[] broadcastDownParams, String broadcastUpAction, android.os.Bundle[] broadcastUpParams, android.os.Bundle[] startActivityParams)
      Add a key mapping into the Programmable Key list
      Parameters:
      keyName - The key name what you want to remap. e.g. "VOLUME_UP"
      keyCode - The key code that you want to remap to. e.g. "25" (VOLUME_DOWN) or "com.unitech.keyremap" (target activity)
      wakeup - Set that pressing the key will wake the screen up or not.
      broadcastDownAction - Set the broadcast action if you want system to send a broadcast while pressing the key down.
      broadcastDownParams - Set the broadcast extras if you want system to send a broadcast while pressing the key down.
      A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)
      broadcastUpAction - Set the broadcast action if you want system to send a broadcast while releasing the key.
      broadcastUpParams - Set the broadcast extras if you want system to send a broadcast while releasing the key.
      A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)
      startActivityParams - Set the extras of the activity intent if the key code is set to start an activity
      A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • resetKeyMappings

      public android.os.Bundle resetKeyMappings()
      Reset all of the key mappings from the Programmable Key service
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • importKeyMappings

      public android.os.Bundle importKeyMappings(String folderPath)
      Import the settings of the key mappings to the folder
      Parameters:
      folderPath - The folder path of settings. e.g. "/sdcard/progkey/"
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • exportKeyMappings

      public android.os.Bundle exportKeyMappings(String folderPath)
      Export the settings of the key mappings to the folder
      Parameters:
      folderPath - The folder path of settings. e.g. "/sdcard/progkey/"
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg = bundle.getString("errorMsg");
    • getKeyMapping

      public android.os.Bundle getKeyMapping(String keyName)
      Get selected keyName mapping value
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
      Other key set include keyCode, keyName, wakeup, broadcastDown(Up)Action.
      broadcastDown(Up)Params, startActivityParams
    • getDefaultKeyCode

      public android.os.Bundle getDefaultKeyCode(String keyName)
      Get selected keyName default KeyCode
      Returns:
      A bundle contains the error code and message
      int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
      String errorMsg=bundle.getString("errorMsg");
      String DefaultKeyCode = bundle.getString("DefaultKeyCode");
    • resetKeyMapping

      public android.os.Bundle resetKeyMapping(String keyName)
      Reset selected keyName to default settings
      Returns:
      Bundle should include the following values:
      "errorCode" - int:
      0: Succeed
      1: Failed
      "errorMsg" - String:
      "Error reason"