device orientationšŸ¤Ø | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

26th Jan 2020, 5:44 AM
Oceanlight
Oceanlight - avatar
7 Respostas
+ 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šŸ˜’
28th Jan 2020, 6:13 PM
Oceanlight
Oceanlight - avatar
+ 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?
29th Jan 2020, 4:05 PM
Oceanlight
Oceanlight - avatar
+ 1
The IDE or app you use does not support or have root access to your phone.
28th Jan 2020, 3:17 PM
Jonhel
+ 1
Jonhele Dano hmmm yes that makes sense, but i tried it in a different IDE and also in my browser. neither worked.
28th Jan 2020, 3:56 PM
Oceanlight
Oceanlight - avatar
+ 1
Is your device is rooted?
28th Jan 2020, 4:01 PM
Jonhel
+ 1
In your source code you need to import the library of accelerometer/gyroscope, and it requires your phone to be rooted
28th Jan 2020, 4:05 PM
Jonhel
+ 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
29th Jan 2020, 1:25 PM
Jonhel