← Back to Emulation domain

Emulation.setSensorOverrideEnabled

Overrides a platform sensor of a given type. If |enabled| is true, calls to Sensor.start() will use a virtual sensor as backend rather than fetching data from a real hardware sensor. Otherwise, existing virtual sensor-backend Sensor objects will fire an error event and new calls to Sensor.start() will attempt to use a real sensor instead.

Domain: Emulation experimental

Parameters

NameTypeDescription
enabledboolean
typeSensorType
metadata (optional)SensorMetadata

Example Request

{
  "id": 1,
  "method": "Emulation.setSensorOverrideEnabled",
  "params": {
    "enabled": true,
    "type": "type-value"
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Emulation.setSensorOverrideEnabled', {"enabled": true, "type": "type-value"});
console.log(result);