Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

Key pressed

A decision block that awaits a key/button press or release.

The fiber will pause until a key has been pressed proceeding through the YES path, or a key was released proceeding through the UP path.

  • Virtual keyboards generally don’t generate key presses.
  • Detecting hardware buttons such as power and volume may not work, or only do so when the screen is on.
  • Detecting volume key long presses on Android 8+ requires the “intercept volume key long press” privilege, the Long press flag, and that consume is enabled.

Input arguments

  • Key codes — a single key code number, or an array of key codes to await, default is all.
  • Key modifiers — modifiers which must be in effect, default is to ignore modifiers.
  • Flags — flags of event to include, default is to ignore flags.
  • Consume — filter the key press from other app. Some key codes can’t be filtered.

Output variables

  • Pressed key code — variable to assign the key code to pressed key.
  • Pressed key modifiers — variable to assign the key modifiers in effect.
Note! This documentation is also accessible within the app from Help & feedback menu.