DeviceMotion is not working

Hello people! How you doing?

So, i’m trying to make a simple APP, just using the DeviceMotion. I just want to track the X,Y and Z from my phone (Live).

I’m using this documentation example
Device Motion Documentation on Ionic

Not even a change in the code, but doesn’t work. Returns a blank screen after the loading of the app.

ionic run android -l -c, returns this error on console: “Failed to navigate: No provider for DeviceMotion!”
Can someone help me?


<ion-content padding>
	<span>{{x}} : {{y}} : {{z}}</span>
	<button (click)="goWaves()">Shake</button>


import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DeviceMotion, DeviceMotionAccelerationData } from '@ionic-native/device-motion';

	selector: 'page-home',
	templateUrl: 'home.html'
export class HomePage {


	constructor(public navCtrl: NavController, private deviceMotion: DeviceMotion) {


		let subscription = this.deviceMotion.watchAcceleration().subscribe((acceleration) => {
			this.x = acceleration.x;
			this.y = acceleration.y;
			this.z = acceleration.z;

You read the docs, right? Especially the bit about adding providers to your app module?

1 Like

Thanks dude, i forgot to set my providers.
Dunno why, but i forgot!

Thanks for spending your time coming here, i appreciate your help!