Package com.casioeurope.mis.edt
Class KeyLibrary
Object
KeyLibrary
public class KeyLibrary extends Object
The CASIO Enterprise Developer Tools Key Library
- Since:
- 2.00
- API Note:
- The SAM Library is bound to the calling application on application startup time automatically.
The Library's lifecycle therefore depends on the application lifecycle.
Due to the Lifecycle of Android Applications and the underlying timing, it is strongly advised not to call any Library Methods inside theonCreate
method.
When the activity is being launched (and hence the process gets created), the same applies to theonStart
andonResume
methods.
If you need to call any Library methods at application start in one of the above mentioned methods, you should use theCallback
Mechanism offered by theonLibraryReady
method instead.
For instance, instead of callingKeyLibrary.setDefaultKeyCode(KeyLibraryConstant.KEYID.CENTERTRIGGER)
directly inonCreate
, use this code to postpone it to aCallback
appropriately:
KeyLibrary.onLibraryReady(new LibraryCallback() { public void onLibraryReady() { KeyLibrary.setDefaultKeyCode(KeyLibraryConstant.KEYID.CENTERTRIGGER); } });
Which can be simplified to:
KeyLibrary.onLibraryReady(() -> { KeyLibrary.setDefaultKeyCode(KeyLibraryConstant.KEYID.CENTERTRIGGER); });
-
Method Summary
Modifier and Type Method Description static void
broadcastKey(String action, String extra, KeyEvent event)
Sends an ordered broadcast key event to all registered receivers for the given intent.
Use this method to circumvent permission issues on key broadcasts with latest android versions.static int
changeKCMapFile(String path, byte[] data)
Change the current Key Character Map File to a new one, providing the bytes that make up the new Key Character Map filestatic boolean
changeKCMapFileToDefault()
Change the current Key Character Map File to the System Default onestatic void
changeTrayIcon(KeyEvent event)
Update the Keyboard's Tray Icon to reflect a state as if the givenKeyEvent
would just have occuredstatic int
clearFnLaunchApplication(int nID)
Clear the application information to be launched when the specified key is pushed in Fn mode.
If you clear the launched application, the key code for the givenKEYID
is generated again.static int
clearLaunchApplication(int nID)
Clear the application information to be launched when the specified key is pushed in 1/A/a mode.
If you clear the launched application, the key code for the givenKEYID
is generated again.static String
getCurrentKCMapFile()
Get the current Key Character Map File namestatic boolean
getFixedNumberMode()
Check whether key input is limited to numeric input onlystatic int
getFnLaunchApplication(int nID, ApplicationInfo appInfo)
Get the application to be launched when the specified key is pushed in Fn mode.static int
getFnUserKeyCode(int nID)
Get the key code generated when the specified key is pushed in Fn mode.static int
getKeypadMode()
Get the currently active Input Mode for the Hardware Keyboardstatic int
getLaunchApplication(int nID, ApplicationInfo appInfo)
Get the application to be launched when the specified key is pushed in 1/A/a mode.static int
getTestMode()
Check whether the Hardware Keyboard is running in "Test Mode"static int
getUserKeyCode(int nID)
Get the key code generated when the specified key is pushed in 1/A/a mode.static boolean
hasHardwareKey(int keyCode)
Check whether a certain keycode corresponds to a key on the Hardware Keyboardstatic boolean
hasWakeupRes(KeyEvent event)
Check whether a certainKeyEvent
can act as Wakeup Resourcestatic boolean
hijackingKey(KeyEvent event, boolean useCache)
Convert a KeyEvent according to alternative mapping tables and apply it after conversionstatic boolean
isDirectInputStyle()
Check whether "Direct Input Mode" is active or not.static boolean
isFinishedHandle()
Check whether all cached Key Events have been processedstatic boolean
isKeyControlMode()
Check whether key input is routed through the hardware keyboard driverstatic boolean
isMethodSupported(String methodName)
static boolean
isMethodSupported(BigInteger method)
Check whether theMethod
indicated by theBigInteger
method parameter is supported on the currently active devicestatic boolean
isWakeupRes(int keyCode)
Check whether a certain keycode is set to act as Wakeup Resourcestatic void
onLibraryReady(LibraryCallback callback)
Add a new Callback to the Queue of Callbacks to be processed once the KeyLibrary Service becomes availablestatic void
performKeyPressFeedback(KeyEvent event)
Apply the configured Feedback (Sound, Vibration, Wakeup, Tray Icon) for the correspondingKeyEvent
static boolean
removeKCMapFile()
Removes the current Key Character Map File and changes back to the System Default onestatic int
setDefaultKeyCode(int nID)
Reset the key code generated when the specified key is pushed in 1/A/a mode to default Key Code setting.static boolean
setDirectInputStyle(boolean enable)
Set whether the "Direct Input Mode" shall be usedstatic boolean
setFixedNumberMode(boolean on)
Set whether the Input Mode shall be fixed to numeric inputstatic int
setFnDefaultKeyCode(int nID)
Reset the key code generated when the specified key is pushed in Fn mode to default Key Code setting.static int
setFnLaunchApplication(int nID, ApplicationInfo appInfo)
Set the application to be launched when the specified key is pushed in Fn mode.
If you set the launched application with this function, the key code is not generated when the key is pushed.static int
setFnUserKeyCode(int nID, int KeyCode)
Set the key code generated when the specified key is pushed in Fn mode.static boolean
setKeyControlMode(boolean enable)
Set whether key input shall be routed through the hardware keyboard driverstatic boolean
setKeypadMode(int mode)
Activate a certain Input Mode for the Hardware Keyboardstatic int
setLaunchApplication(int nID, ApplicationInfo appInfo)
Set the application to be launched when the specified key is pushed in 1/A/a mode.
If you set the launched application with this function, the key code is not generated when the key is pushed.static int
setUserKeyCode(int nID, int KeyCode)
Set the key code generated when the specified key is pushed in 1/A/a mode.static boolean
setWakeupRes(int resourceID, boolean enabled)
Activate or deactivate a certain keyboard resource to act as Wakeup Resourcestatic void
updateMetaState(KeyEvent event)
Update the Tray Icon Meta State for the correspondingKeyEvent
-
Method Details
-
getUserKeyCode
public static int getUserKeyCode(int nID) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the key code generated when the specified key is pushed in 1/A/a mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
: The key code generated when the specified key is pushed in 1/A/a mode on success or:
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
setDefaultKeyCode
Reset the key code generated when the specified key is pushed in 1/A/a mode to default Key Code setting.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
setFnUserKeyCode
public static int setFnUserKeyCode(int nID, int KeyCode) throws RemoteException, UnsupportedOperationExceptionSet the key code generated when the specified key is pushed in Fn mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.KeyCode
-int
: Specifies the Key Code for the target key.
To specify Android standard Key Codes, please refer to the constant definition from theKeyEvent
class of the Android API.
To specify CASIO device specific Key Codes, please use the Key Codes defined in theKEYCODE
constants.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
setUserKeyCode
public static int setUserKeyCode(int nID, int KeyCode) throws RemoteException, UnsupportedOperationExceptionSet the key code generated when the specified key is pushed in 1/A/a mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.KeyCode
-int
: Specifies the Key Code for the target key.
To specify Android standard Key Codes, please refer to the constant definition from theKeyEvent
class of the Android API.
To specify CASIO device specific Key Codes, please use the Key Codes defined in theKEYCODE
constants.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
getFnUserKeyCode
public static int getFnUserKeyCode(int nID) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the key code generated when the specified key is pushed in Fn mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
: The key code generated when the specified key is pushed in Fn mode on success or:
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
setFnDefaultKeyCode
public static int setFnDefaultKeyCode(int nID) throws RemoteException, UnsupportedOperationExceptionReset the key code generated when the specified key is pushed in Fn mode to default Key Code setting.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
setLaunchApplication
public static int setLaunchApplication(int nID, ApplicationInfo appInfo) throws RemoteException, UnsupportedOperationExceptionSet the application to be launched when the specified key is pushed in 1/A/a mode.
If you set the launched application with this function, the key code is not generated when the key is pushed. If you clear the launched application, the key code is generated again.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.appInfo
-ApplicationInfo
: Specifies theApplicationInfo
of the Application to be launched.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
getLaunchApplication
public static int getLaunchApplication(int nID, ApplicationInfo appInfo) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the application to be launched when the specified key is pushed in 1/A/a mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.appInfo
-ApplicationInfo
: Acquires theApplicationInfo
of the Application to be launched.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
clearLaunchApplication
public static int clearLaunchApplication(int nID) throws RemoteException, UnsupportedOperationExceptionClear the application information to be launched when the specified key is pushed in 1/A/a mode.
If you clear the launched application, the key code for the givenKEYID
is generated again.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
setFnLaunchApplication
public static int setFnLaunchApplication(int nID, ApplicationInfo appInfo) throws RemoteException, UnsupportedOperationExceptionSet the application to be launched when the specified key is pushed in Fn mode.
If you set the launched application with this function, the key code is not generated when the key is pushed. If you clear the launched application, the key code is generated again.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.appInfo
-ApplicationInfo
: Specifies theApplicationInfo
of the Application to be launched.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
getFnLaunchApplication
public static int getFnLaunchApplication(int nID, ApplicationInfo appInfo) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the application to be launched when the specified key is pushed in Fn mode.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.appInfo
-ApplicationInfo
: Acquires theApplicationInfo
of the Application to be launched.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
clearFnLaunchApplication
public static int clearFnLaunchApplication(int nID) throws RemoteException, UnsupportedOperationExceptionClear the application information to be launched when the specified key is pushed in Fn mode.
If you clear the launched application, the key code for the givenKEYID
is generated again.- Parameters:
nID
-int
: Specifies theKEYID
of the target key.KEYID
constants for each key can be found in theKEYID
class.- Returns:
int
:
SUCCESS
: Success
ERROR_NOTSUPPORTED
: Unsupported error
ERROR_FUNCTION
: Internal error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-
broadcastKey
public static void broadcastKey(String action, String extra, KeyEvent event) throws RemoteException, UnsupportedOperationExceptionSends an ordered broadcast key event to all registered receivers for the given intent.
Use this method to circumvent permission issues on key broadcasts with latest android versions.- Parameters:
action
-String
: Specifies theIntent
's action parameter for the broadcast key event.BroadcastReceiver
s need to register to matching actions to receive the broadcast.extra
-String
: Specifies theIntent
's extra parameter for the broadcast key event.event
-KeyEvent
: Specifies theKeyEvent
to be broadcasted.- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
changeKCMapFile
public static int changeKCMapFile(String path, byte[] data) throws RemoteException, UnsupportedOperationExceptionChange the current Key Character Map File to a new one, providing the bytes that make up the new Key Character Map file- Parameters:
path
-String
: Specifies the Key Character Map File to be used.
The filename may or may not contain a full path.data
-byte[]
: The data of the new Key Character Map File.- Returns:
int
:
SUCCESS
: Success
ERROR_KCM
: Error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
changeKCMapFileToDefault
public static boolean changeKCMapFileToDefault() throws RemoteException, UnsupportedOperationExceptionChange the current Key Character Map File to the System Default one- Returns:
boolean
: Returns true on success and false on failure.- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
changeTrayIcon
public static void changeTrayIcon(KeyEvent event) throws RemoteException, UnsupportedOperationExceptionUpdate the Keyboard's Tray Icon to reflect a state as if the givenKeyEvent
would just have occured- Parameters:
event
-KeyEvent
: Specifies theKeyEvent
that reflects the desired Keyboard's Tray Icon state- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
getCurrentKCMapFile
public static String getCurrentKCMapFile() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the current Key Character Map File name- Returns:
String
: Returns the name of the current Key Character Map File, or null on failure.- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
getKeypadMode
public static int getKeypadMode() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGet the currently active Input Mode for the Hardware Keyboard- Returns:
int
: Currently active Keyboard Input Mode.
Possible values are:
INPUT_MODE_NUMERIC
: Numeric Keyboard Input Mode
INPUT_MODE_SMALL_ALPHA
: Alpha (Small Letters) Keyboard Input Mode
INPUT_MODE_CAPITAL_ALPHA
: Alpha (Capital Letters) Keyboard Input Mode
INPUT_MODE_FN
: Fn Keyboard Input Mode
ERROR_NOTSUPPORTED
: Unsupported error- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
getTestMode
public static int getTestMode() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether the Hardware Keyboard is running in "Test Mode"- Returns:
int
: 0 if Test Mode is disabled, other values indicate certain kind of test modes- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
hasHardwareKey
public static boolean hasHardwareKey(int keyCode) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether a certain keycode corresponds to a key on the Hardware Keyboard- Parameters:
keyCode
-int
: Specifies the keycode to be checked- Returns:
boolean
: true if the keycode is available on the Hardware Keyboard, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
hasWakeupRes
public static boolean hasWakeupRes(KeyEvent event) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether a certainKeyEvent
can act as Wakeup Resource- Parameters:
event
-KeyEvent
: Specifies theKeyEvent
to be checked- Returns:
boolean
: true if theKeyEvent
can act as Wakeup Resource, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
hijackingKey
public static boolean hijackingKey(KeyEvent event, boolean useCache) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionConvert a KeyEvent according to alternative mapping tables and apply it after conversion- Parameters:
event
-KeyEvent
: Specifies theKeyEvent
to be converted and applieduseCache
-boolean
: True if events shall be cached, otherwise false- Returns:
boolean
: true if theKeyEvent
could be converted and applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
isDirectInputStyle
public static boolean isDirectInputStyle() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether "Direct Input Mode" is active or not.- Returns:
boolean
: true if "Direct Input Mode" is active, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
isFinishedHandle
public static boolean isFinishedHandle() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether all cached Key Events have been processed- Returns:
boolean
: true if all cached Key Events have been processed, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
isKeyControlMode
public static boolean isKeyControlMode() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether key input is routed through the hardware keyboard driver- Returns:
boolean
: true if key input is routed through the hardware keyboard driver, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
isWakeupRes
public static boolean isWakeupRes(int keyCode) throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether a certain keycode is set to act as Wakeup Resource- Parameters:
keyCode
-int
: The keycode to be checked- Returns:
boolean
: true if the keycode is set to act as Wakeup Resource, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
performKeyPressFeedback
public static void performKeyPressFeedback(KeyEvent event) throws RemoteException, UnsupportedOperationExceptionApply the configured Feedback (Sound, Vibration, Wakeup, Tray Icon) for the correspondingKeyEvent
- Parameters:
event
-KeyEvent
: Specifies theKeyEvent
for which the Feedback shall be performed- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
removeKCMapFile
Removes the current Key Character Map File and changes back to the System Default one- Returns:
boolean
: Returns true on success and false on failure.- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
setDirectInputStyle
public static boolean setDirectInputStyle(boolean enable) throws RemoteException, UnsupportedOperationExceptionSet whether the "Direct Input Mode" shall be used- Parameters:
enable
-boolean
: true if "Direct Input Mode" shall be used, otherwise false- Returns:
boolean
: true if the setting could be applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
getFixedNumberMode
public static boolean getFixedNumberMode() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionCheck whether key input is limited to numeric input only- Returns:
boolean
: true if key input is limited to numeric input only, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.02
-
setFixedNumberMode
public static boolean setFixedNumberMode(boolean on) throws RemoteException, UnsupportedOperationExceptionSet whether the Input Mode shall be fixed to numeric input- Parameters:
on
-boolean
: true if the Input Mode shall be fixed to numeric input, otherwise false- Returns:
boolean
: true if the setting could be applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
setKeyControlMode
public static boolean setKeyControlMode(boolean enable) throws RemoteException, UnsupportedOperationExceptionSet whether key input shall be routed through the hardware keyboard driver- Parameters:
enable
-boolean
: true if the key input shall be routed through the hardware keyboard driver, otherwise false- Returns:
boolean
: true if the setting could be applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
setKeypadMode
public static boolean setKeypadMode(int mode) throws RemoteException, UnsupportedOperationExceptionActivate a certain Input Mode for the Hardware Keyboard- Parameters:
mode
-int
: Keyboard Input Mode to be used.
Valid values are:
INPUT_MODE_NUMERIC
: Numeric Keyboard Input Mode
INPUT_MODE_SMALL_ALPHA
: Alpha (Small Letters) Keyboard Input Mode
INPUT_MODE_CAPITAL_ALPHA
: Alpha (Capital Letters) Keyboard Input Mode
INPUT_MODE_FN
: Fn Keyboard Input Mode- Returns:
boolean
: true if the setting could be applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
setWakeupRes
public static boolean setWakeupRes(int resourceID, boolean enabled) throws RemoteException, UnsupportedOperationExceptionActivate or deactivate a certain keyboard resource to act as Wakeup Resource- Parameters:
resourceID
-int
: The keyboard resource to act as Wakeup Resourceenabled
-boolean
: true if the keyboard resource shall act as Wakeup Resource, otherwise false- Returns:
boolean
: true if the setting could be applied, otherwise false- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
updateMetaState
public static void updateMetaState(KeyEvent event) throws RemoteException, UnsupportedOperationExceptionUpdate the Tray Icon Meta State for the correspondingKeyEvent
- Parameters:
event
-KeyEvent
: Specifies theKeyEvent
for which the Tray Icon Meta State shall be updated- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.02
-
isMethodSupported
Check whether theMethod
indicated by theBigInteger
method parameter is supported on the currently active device- Parameters:
method
-BigInteger
: Constant referencing the method to be checked- Returns:
boolean
:true
if the method is supported on the currently active device, otherwisefalse
- Throws:
IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
isMethodSupported
Check whether theMethod
indicated by theString
methodName parameter is supported on the currently active device- Parameters:
methodName
-String
: Name of the method to be checked- Returns:
boolean
:true
if the method is supported on the currently active device, otherwisefalse
- Throws:
IllegalStateException
- Gets thrown when the Library is not ready yet to accept method calls.
In such case, please useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.- Since:
- 2.00
-
onLibraryReady
public static void onLibraryReady(LibraryCallback callback) throws RemoteException, UnsupportedOperationExceptionAdd a new Callback to the Queue of Callbacks to be processed once the KeyLibrary Service becomes available- Parameters:
callback
-LibraryCallback
: Instance of theLibraryCallback
Interface which holds theonLibraryReady()
Method which will get called once the regarding library becomes available- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.- Since:
- 2.00
-