DeviceMotion throws 'cordova_not_available'


#1

After installing:
ionic plugin add cordova-plugin-device-motion
importing:
import {DeviceMotion} from 'ionic-native';
and running:
var subscription = DeviceMotion.watchAcceleration().subscribe(acceleration => { console.log(acceleration); });

I’m getting 2 errors:
plugin.js:129 TypeError: Cannot read property 'clearWatch' of undefined(…)
and
'cordova_not_available'

By the way I’m also using cordova-plugin-camera and it works flawlessly.

Any ideas how to fix?


#2

Same goes to this plugin:


#3

Doesn’t work with ionic serve or ionic upload. only on a real device or an emulator.


#4

Sounds like a bug to me. When others works fine with ionic run android -l -c -s but these two doesn’t :confused: