• 8

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

DeviceOrientation API not working on Cordova/Android

I have a Cordova app, which I'm building for both iOS and Android. I'm using the HTML5 DeviceOrientation API (https://w3c.github.io/deviceorientation/) to obtain the device's orientation.

I install an event listener for "deviceorientation", and then process the event.alpha/beta/gamma values to determine orientation.

This works fine on iOS, but on Android it doesn't work. On Android, the "deviceorientation" event occurs only once, and the alpha/beta/gamma values are all null. Changing orientation after that does not result in any new events.

Has anyone experienced this? Any pointers on how I can debug?

      • 2
    • So, I've found that this is only an issue with the Samsung J3 that I was using to test. I tried on other Android phones (at least the Pixel), and it worked fine. Anyone know why the J3 is different? Is it possible that it does not have accelerators?