Using Push-to-Talk

Enables Push-to-Talk functions on a Zebra device without unlocking it



EMDK For Android - 13.0


Supported on all Zebra Android devices


This sample app demonstrates how the Push-to-Talk button on a Zebra device can be detected by Push-to-Talk applications to allow PTT functions to operate without unlocking the device.


  • Zebra device with a PTT button running Android 6.x (Marshmallow) or later


Zebra does not recommend using this utility for production environments. This app is an example of how to detect PTT buttons while the Android screen is locked. No Zebra support or warranty is expressed or implied.

Remote Key Intents

In current versions of Android, only foreground apps are able to receive the events generated by the keyboards, GPIO keys, touch screen and other input devices (except HOME and BACK keys, etc.). Some of the enterprise features and apps developed for Zebra devices require certain KeyEvents to be notified even when they are running in the background. The Remote KeyEvent Service (RKES) service facilitates such notifications and uses intents to alert apps to four preconfigured KeyEvents that cannot be changed.

Remote key intent format

Intent Action: Specifies the KeyEvent that generated the intent

Intent extras: Intent.EXTRA_KEY_EVENT: KeyEvent object

Learn more about KeyEvents

Event objects are generated from RKES using the following data:

Key Code

  • Action: 0 = key down; 1 = key up
  • Down time
  • Time of event
  • Repeat count

The intent format applies to all intents broadcast by RKES. The following section briefly describes each intent broadcast.


Broadcast when a KeyEvent corresponding to the key code KEYCODE_BUTTON_L1 (102) occurs.
Reserved for scanning.


Broadcast when a KeyEvent corresponding to the key code KEYCODE_BUTTON_L2 (104) occurs.
Used for Push-to-Talk


Broadcast when a KeyEvent corresponding to the key code KEYCODE_BUTTON_R1 (103) occurs.
Reserved for scanning.


Broadcast when a KeyEvent corresponding to the key code KEYCODE_BUTTON_R2 (105) occurs.
Used for headset button during Push-to-Talk sessions

Sample code

The snippet below shows the broadcast receiver object. Full source code is provided in the project download file.

  //Broadcast Receiver object
  private static BroadcastReceiver keyReceivers = null;

  public void createButtonReceiver() {
     //Create intent filter with the required remote KeyEvent (intent) that
     //needs to be received/processed by the application
     final IntentFilter requestFilter = new IntentFilter();
     if (keyReceivers != null) {
        keyReceivers = null;
     if (keyReceivers == null) {
        //Create new broadcast receiver object and override onReceive method
        keyReceivers = new BroadcastReceiver() {
           public synchronized void onReceive(Context context, final Intent intent) {
              try {
                 if (intent == null || intent.getAction() == null)
                 KeyEvent event = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
                 if (event == null)
                 keyAction = event.getAction();
                 if (event.getRepeatCount() != 0)
                 String message = "Receiving key intent: " + intent.getAction() + " : "
                                  + (keyAction == KeyEvent.ACTION_DOWN ? "DOWN" : "UP");
                 Log.v(TAG, message);
              } catch (Exception e) {