[](https://www.npmjs.com/package/@uni/accelerometer)
npm install @uni/accelerometerAccelerometer monitor and cancel.

``bash`
$ npm install @uni/accelerometer --save
Monitoring acceleration data, the callback interval is 500ms, the interactive calls will automatically start listening, can use offChange() to stop listening.
#### Parameters
| Property | Type | Description | Support |
| -------- | -------- | ------------- | :-----: |
| callback | Function | The callback function |
|
Stop listening for acceleration data.
#### 是否需要传 callback 值
If the callback value is not passed, all event callbacks will be removed. The sample code is as follows:
``
accelerometer.offChange();
Pass the callback value and only remove the corresponding callback event. The sample code is as follows:
``
accelerometer.offChange(this.callback);
`js
import accelerometer from '@uni/accelerometer';
accelerometer.onChange(res => {
console.log(res.x);
console.log(res.y);
console.log(res.z);
});
accelerometer.offChange();
`
You can also import from the big package:
`js``
import {accelerometer} from '@uni/apis';
