Gyroscope is not working

Hello everyone !!! I

I tried all these native elements(gyroscope,stepcounter and pedometer) but i couldnt get any data. does anyone who were able to use one of these three ? Any sample ?

Thanks in advanced

For cordova-plugin-gyroscope

I’ve managed it to work, it does actually out of the box.
Go to ionic native gyroscope and follow example. Only thing i needed to do is to wrap it in function and place it inside constructor to start it automatically like so (multiplier and Math.floor are not neccessary, i just added it to make results dispplay in integers):

    console.log('starting Gyroscope');
  // this.gyroscope.getCurrent({frequency: 500})
  .then((orientation: GyroscopeOrientation) => {
    orientation.x = this.multiplier * orientation.x;
    orientation.y = this.multiplier * orientation.y;
    orientation.z = this.multiplier * orientation.y;
     console.log('Gyroscope current: ',orientation.x, orientation.y, orientation.z, orientation.timestamp);
   .subscribe((orientation: GyroscopeOrientation) => {
    orientation.x = Math.floor(this.multiplier * orientation.x);
    orientation.y = Math.floor(this.multiplier * orientation.y);
    orientation.z = Math.floor(this.multiplier * orientation.z);
    var x = typeof(orientation.x);
    var y = typeof(orientation.y);
    var z = typeof(orientation.z);
    console.log(' Gyroscope subscribe(x,y,z): '+ orientation.x+ ', ' + orientation.y+ ', ' + orientation.z+ ', Typeof(x,y,z): ' + x + ', ' + y + ', ' + z);


also add below to your app.component.ts:

import { Gyroscope } from '@ionic-native/gyroscope';

as well as below to providers section of same file:

Than open console and you should see output of coordinates.

Note, i did not get any output on Motorola Moto G ( which has got gyroscope - I am getting NaN error) nor Lenovo K5 (this one doesn’t seem to have gyroscope).
It did work on Sony Xperia Z5.

Good luck.