Trigger: Volume Button Long Press

This trigger will fire when you long press the volume up or down button on the device. Unlike the standard Volume Button trigger, this trigger should fire even when the screen is off.

Options

  • Volume Up: Trigger on long press of the volume up button
  • Volume Down: Trigger on long press of the volume down button

Requirements

This trigger requires special permissions that can be granted in one of two ways:

  • Root Access: On rooted devices, the permission is granted automatically when the trigger is enabled
  • ADB Hack: On non-rooted devices, use ADB from a connected PC to grant the required permission:
adb shell pm grant com.arlosoft.macrodroid android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER

Configuration

  • Requires Android 8.0 (Oreo, API 26) or higher
  • Requires Notification Access permission
  • The trigger begins working immediately after the permission is granted (even if you grant it while on the macro edit screen)

Examples

Triggers

Volume Button Long Press (Volume Down)
Actions

Torch: Toggle
Vibrate: 100ms

Toggle flashlight with a long press of volume down, even when screen is off.


Triggers

Volume Button Long Press (Volume Up)
Actions

Media Control: Play/Pause
Vibrate: 50ms
Constraints

Screen State: Screen Off

Control media playback with a long press of volume up when the screen is off.

Notes

  • This trigger uses a private Android API that could potentially be blocked in future versions of Android or by future MacroDroid updates.
  • A warning is displayed when first adding this trigger to inform users about the private API usage.
  • Unlike the standard Volume Button Press trigger, this trigger works reliably even when the device screen is off.
  • This is particularly useful for pocket operation scenarios.

See Also