Questions tagged [devicemotion]
72 questions
15
votes
1 answer
How to solve a problem with devicemotion script?
I'm not sure if this is the right place to ask, but I have a problem with my devicemotion script.
I have some code that runs when the page is loaded to check if there is a gyroscope available or not. I do this in the following way:
function…

FutureCake
- 2,614
- 3
- 27
- 70
13
votes
5 answers
How do I get DeviceOrientationEvent and DeviceMotionEvent to work on Safari?
I'm trying to implement DeviceOrientationEvent and DeviceMotionEvent on my website for a 3D effect. However, the console doesn't log any info and apparently iOS 13 requires a user set permission to start doing this. I can't seem to figure out how to…

Siemen Gijbels
- 35
- 1
- 1
- 17
11
votes
2 answers
In IOS 11, DeviceMotion in background stopped working
My app reports and records location, altitude, rotation and accelerometer data (DeviceMotion) while in the background. This works fine on ios 10.3.3. On IOS 11, I no longer have access motion data while the device is locked. Altitude data and…

Nicholas K
- 151
- 1
- 10
8
votes
1 answer
Getting error "[DeviceMotion] Event ref invalid" when running ARKit app
I am trying to run a simple app with the ARKit and whenever I run the app, I get the following error.
2017-10-02 15:16:17.717533-0700 MyARKitProject [3702:2654241] [DeviceMotion] Event ref invalid

unknown_jy
- 757
- 9
- 19
8
votes
0 answers
Get HTML5 deviceMotion events fire at a higher rate
I am currently developing mobile web apps that make an extensive use of the deviceOrientation and deviceMotion HTML5 APIs. In most mobile browsers, the event fires every 50 millisecond which is too slow for the precision I need: is there a way to…

Robi
- 101
- 1
- 3
7
votes
1 answer
Detecting device motion/orientation support?
I'm looking for a way to check if a device supports either the DeviceOrientationEvent or DeviceMotionEvent. To be more precisely I wan't to know if the device really has an accelerometer.
Unfortunately window.DeviceMotionEvent and…

Vispercept
- 105
- 1
- 9
6
votes
1 answer
Accelerometer event frequency slows down first 5 min using Angular Ionic on Android device
I am using
window.addEventListener('devicemotion', event => this.watchDeviceMotion(event))
watchDeviceMotion(event: any) {
let motionData = {
x: event.acceleration.x,
y: event.acceleration.y,
z: event.acceleration.z,
}
let…

Daniel T.
- 451
- 1
- 8
- 23
6
votes
1 answer
How to detect apple watch position using accelerometer and Gravity in swift?
I have creating an application for apple watch. The Logic is, when the user rise their hand and tap a button from app. At that time I will fetch the accelerometer values. And whenever user rise their hand and meet the captured position, I have to…

Muthu Sabarinathan
- 1,198
- 2
- 21
- 49
5
votes
0 answers
Reading accelerometer data while the app is running in background
I want to build an Ionic app that can still use accelerometer data while the app is minimized (runs in the background).
I have tried using:
The Ionic Device Motion Plugin
https://ionicframework.com/docs/native/device-motion
The Device Motion Web…

treecon
- 2,415
- 2
- 14
- 28
5
votes
0 answers
iOS DeviceMotion yaw and roll on Landscape vs Portrait
I'm implementing a 360 video viewer on iOS using the gyroscope, I need to get two rotations for the video, I used this;
self.motionManager.deviceMotionUpdateInterval = 1.0/60.0;
if (self.motionManager.isDeviceMotionAvailable) {
…

Jose Gomez
- 51
- 2
5
votes
1 answer
HTML5/Javascript calculate device speed using devicemotion/deviceorientation
Is it somehow possible to calculate the device speed in km/h using devicemotion/deviceorientation HTML5 API?
I would like to know if a user is walking/running/not moving and I can't use geolocation API as it has to work inside buildings as well.

Scdev
- 373
- 2
- 13
4
votes
1 answer
How can i get device tilt in xamarin forms?
I´d like to get the tilt of the device, so i can use this to mesure the tilt os some surface, laying down the device over the surface.
Right now i am using Device Motion Plugin for xamarin forms from here…

gilberto
- 157
- 3
- 13
4
votes
1 answer
iOS 9 Chrome & Safari - devicemotion and deviceorientation does not work
Unfortunately recently I have been able to register handlers for events on the window object for deviceorientation and devicemotion. However, I am now completely unable to get iOS 9.3 Chrome or Safari to access orientiation or motion information.
I…

Matthew O'Riordan
- 7,981
- 4
- 45
- 59
3
votes
0 answers
What to do if in react-native DeviceMotion is not available?
In my react-native app I use DeviceMotion from expo-sensors, when running await DeviceMotion.isAvailableAsync() line it returns false.
In any documentation that I read, it's not said what to do in this case. Is it a limitation of the device itself?…

user2626972
- 539
- 2
- 7
- 14
3
votes
0 answers
How does Apple separate gravity from device acceleration in iPhone using accelerometer and gyroscope?
I know by combining accelerometer and gyroscope, we can access the gravity and device motion separately. But I need to know how does Xcode calculate it when I simply using devicemotion.gravity. Any algorithm available?

Lynn_Yang
- 157
- 1
- 11