+ 5
device orientation🤨
I’ve been trying to find out how to access the devices accelerometer/gyroscope and got this code, but I’m having trouble making it work. Any ideas? I also found some resources on the device orientation api: https://www.w3.org/TR/orientation-event/ https://stackoverflow.com/questions/4378435/how-to-access-accelerometer-gyroscope-data-from-javascript Feel free to use, edit and republish the code https://code.sololearn.com/WrzLopc29d4f/?ref=app
7 Réponses
+ 3
ohh I’m on ios, so I’d have to jailbreak my device
But srsly? you should totally be able to access the accelerometer/gyroscope😒
+ 2
yes i could... i’ve written a few ios apps. I’d assume that apple has some special framework just for that purpose (i think it’s the core motion framework)
unfortunately learning about this might not help me much with the web-based system.
how would you go about doing this for android, though?
+ 1
The IDE or app you use does not support or have root access to your phone.
+ 1
Jonhele Dano hmmm yes that makes sense, but i tried it in a different IDE and also in my browser. neither worked.
+ 1
Is your device is rooted?
+ 1
In your source code you need to import the library of accelerometer/gyroscope, and it requires your phone to be rooted
+ 1
Hahaha I thougth u're using android phone, ios/apple doesn't allow u to manipulate their operating system on your phone, except android/linux
.
That's too hard to comunicate or call the gyroscope of your phone using web-based system..
.
U should try other apps with gyroscope/accelerometer, and learn the algorythm with it