Skip to main content
Glama
devicemotion.md1.87 kB
--- title: DeviceMotion description: A library that provides access to a device's motion and orientation sensors. sourceCodeUrl: https://github.com/expo/expo/tree/main/packages/expo-sensors packageName: expo-sensors iconUrl: /static/images/packages/expo-sensors.png platforms: ["android", "ios", "web"] --- import { ConfigReactNative, ConfigPluginExample, ConfigPluginProperties, } from '~/ui/components/ConfigSection'; `DeviceMotion` from `expo-sensors` provides access to the device motion and orientation sensors. All data is presented in terms of three axes that run through a device. According to portrait orientation: X runs from left to right, Y from bottom to top and Z perpendicularly through the screen from back to front. ## Installation ## Configuration in app config You can configure `DeviceMotion` from `expo-sensor` using its built-in [config plugin](/config-plugins/introduction/) if you use config plugins in your project ([EAS Build](/build/introduction) or `npx expo run:[android|ios]`). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. ```json app.json { "expo": { "plugins": [ [ "expo-sensors", { "motionPermission": "Allow $(PRODUCT_NAME) to access your device motion." } ] ] } } ``` If you're not using Continuous Native Generation ([CNG](/workflow/continuous-native-generation/)) or you're using native **ios** project manually, then you need to configure `NSMotionUsageDescription` key in your native project to access `DeviceMotion` stats: ```xml ios/[app]/Info.plist <key>NSMotionUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your device motion</string> ``` ## API ```js ``` ## Permissions ### iOS The following usage description keys are used by this library:

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaksm/expo-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server