Skip to main content

Hold Down Two Virtual Hardware Buttons Using the API

Certain menus on virtual devices are only accessible by holding multiple hardware buttons down for a certain amount of time.

You can perform such actions using the Corellium API with just a few lines of JavaScript.

Sample Code

The following script holds down your Corellium device's virtual Power and Volume Up buttons for three seconds.

const { Corellium } = require("@corellium/corellium-api");
const { Input } =

const corellium = new Corellium({

async function main() {
await corellium.login();

let project = await corellium.projectNamed('Default Project');
let instance = await project.getInstance('<INSTANCE_ID>');

await instance.sendInput(new Input().press('power','volume-up').delay(3000).release('power','volume-up'));


main().catch((err) => {

How to Execute the Code

  1. Create a new device. We use a Generic Android 12 in our example.

  2. Install Node.js and the Corellium API package.

    brew install node
    npm install @corellium/corellium-api
  3. Copy the code above and save it to a file on your computer. We use ~/Desktop/multiPressAPIExample.js in our example.

  4. Adjust the const { Input } = require(..); line to match your computer. Find the path by searching your local environment's filesystem. On macOS, run:

    find / -type d -name "corellium-api" 2>/dev/null | grep -vE "^/System/Volumes/" | grep "node_modules/@corellium"
  5. Adjust the const { Input } = require(..); line to match your local environment.

    echo "${HOME}"
  1. Adjust the endpoint:'..', line for your Corellium domain, for example, or

  2. Adjust the apiToken:'..' line for your Corellium API token.

    API token example

  3. Adjust the let instance = await project.getInstance(..); line for your instance's unique identifier. (You can find the identifier in the browser URL for your device or by using an API call such as Project.instances().)

  1. Execute the JavaScript code using Terminal.

    node ${HOME}/Desktop/multiPressAPIExample.js
  2. You should see the Android 12 power menu appear on the device.

    Power menu on the Android device