Volume keys custom

What is customization of volume key?

Volume key customization function is added to SUNMI above 2.1.0 version. The user can set in System Setting single press of upper & lower volume key to carry out shortcuts of specified App’s specific functions. The setup process is shown as follows.


How to use it by the developer?

The currently supported shortcuts include: open App, open code scanning page, open and display QR code page.

Among it, to set open App can be realized without the cooperation of App developer to modify the code. It is required by code scanning & QR code display that App itself has these functions. Afterwards, the developer adds configuration information in the configuration of this function page in AndroidManifest.xml according to Sunmi rules, then the user can specify pressing volume to operate these functions of this App in the customization of the volume key.

All the configurations are added in the project’s AndroidManifest.xml. Take the example of the support to quickly enabling code scanning as follows to introduce the configuration information that is required to be added in his/her own App.

1.       Set the enable mode as singleInstance in Activity configuration of the code scanning page.
2.       Add category in intent-filter configuration, with a fixed writing of android.intent.category.DEFAULT.
3.       Add action in intent-filter, the rule of action is: name of the developer’s App package + business function suffix specified by Sunmi. If your App package name is com.example.test, business function name is scan, then actioname is com.example.test.scan, as shown in the following figure.


The configuration method of displaying QR code is similar, yet the action configuration item is different. The list of all action actions is as follows.

Text displayed in the device       Action name     Complete action example  
      Enable App          
      Code scanning      
     Display QR code      

Note: the above are the currently supported operations. More operation actions will be added subsequently.