v151 · sensors · permissions

DeviceOrientation Events Permission Request API

DeviceMotionEvent.requestPermission() and DeviceOrientationEvent.requestPermission() return a promise resolving to "granted" or "denied" — a user-gesture-triggered permission flow for sensor access.

concepts

  1. Permission Flow

    Click a button to call requestPermission(). See the returned state — granted, denied, or not available on this device.

  2. Live Sensor Data

    After permission is granted, read live deviceorientation and devicemotion events and display alpha/beta/gamma values in real time.

references