How to Block and Capture Power Button Events Using AIDL Interface

From wizarPOS
Revision as of 23:05, 9 January 2024 by Simon (talk | contribs)

Overview

This guide provides instructions on using the Android Interface Definition Language (AIDL) to block and capture power button events on Android devices. This functionality is useful for controlling how the power button behaves in your application.

Implementation Steps

  1. Connecting to the Service:
    • To utilize this feature, connect to the AIDL service.
    • Use 'com.wizarpos.wizarviewagentassistant' as the package name.
    • Set 'com.wizarpos.wizarviewagentassistant.SystemExtApiService' as the class name.
  2. Importing and Permissions:
    • Import the 'wizarviewagentassistant' into your application.
    • Add the necessary permissions to your app’s Android manifest file to use this interface effectively.
  3. Version Requirements:
    • Ensure that the version of 'wizarviewagentassistant' in your application is version 2.10.59 or higher.
    • Compatible system versions include Q2P: S0397, Q2A7: S51099, S0397, Q3V: S1524, and Q2: S4957.

Permission

The application declares the following permissions in the manifest:

 android.permission.CLOUDPOS_DISABLE_POWER_KEY

API Overview

blockPowerKey

void setPowerKeyBlocked(boolean enable);

Block or release the power button.

Parameters
enbale boolean: true:block The power button; false:release the Power button ;

isPowerKeyBlocked

boolean isPowerKeyBlocked();

Check whether power button has been blocked.

Returns
enbale boolean: true:blocked; false:released ;

Download

AIDL file

Please download the aidl file

Demo

Please download the demo APP