Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11531

Restart Accelerometer on CyanogenMod 13

Details

    Description

      When the accelerometer is started for the first time via the navigator.accelerometer.watchAccleration() function it works fine. But when the accelerometer is stopped (via navigator.accelerometer.clearWatch()) and then started again after a timeout the success callback is not called anymore.
      It works on a Samsung Galaxy S III with the original Android ROM installed.

      Further details about the issue can be found here: https://stackoverflow.com/questions/38027898/phonegap-restart-accelerometer?noredirect=1#comment63775867_38027898

      Attachments

        Issue Links

          Activity

            Reproduced with Android 6 emulator (api23) - getAcceleration/watchAcceleration returns only one value, then no success or fail callbacks are fired.

            daserge Sergey Shakhnazarov added a comment - Reproduced with Android 6 emulator (api23) - getAcceleration/watchAcceleration returns only one value, then no success or fail callbacks are fired.

            Mocked the acceleration values using this approach:
            http://stackoverflow.com/questions/3921467/how-can-i-simulate-accelerometer-in-android-emulator/20361772#20361772

            telnet localhost 5554
            sensor set acceleration 0:0:0
            sensor set acceleration 99:99:99

            Values are being updated properly during the first watch and stops updating on clear/successive watch.

            daserge Sergey Shakhnazarov added a comment - Mocked the acceleration values using this approach: http://stackoverflow.com/questions/3921467/how-can-i-simulate-accelerometer-in-android-emulator/20361772#20361772 telnet localhost 5554 sensor set acceleration 0:0:0 sensor set acceleration 99:99:99 Values are being updated properly during the first watch and stops updating on clear /successive watch .

            The same issue reproduces on Android 5.1.1 emulator (api22) but not on device (Galaxy S4 5.0.1).

            daserge Sergey Shakhnazarov added a comment - The same issue reproduces on Android 5.1.1 emulator (api22) but not on device (Galaxy S4 5.0.1).
            githubbot ASF GitHub Bot added a comment -

            GitHub user daserge opened a pull request:

            https://github.com/apache/cordova-plugin-device-motion/pull/45

            CB-11531 Restart Accelerometer on CyanogenMod 13

            <!--
            Please make sure the checklist boxes are all checked before submitting the PR. The checklist
            is intended as a quick reference, for complete details please see our Contributor Guidelines:

            http://cordova.apache.org/contribute/contribute_guidelines.html

            Thanks!
            -->

                1. Platforms affected
                  Android
                1. What does this PR do?
                  Reset sensor `accuracy` after setting it to `SENSOR_STATUS_UNRELIABLE` in `stop` so that check in `onSensorChanged` passes.
                1. What testing has been done on this change?
                  Tested on api22, api23 emulators, api22 device.
                1. Checklist

            You can merge this pull request into a Git repository by running:

            $ git pull https://github.com/daserge/cordova-plugin-device-motion CB-11531

            Alternatively you can review and apply these changes as the patch at:

            https://github.com/apache/cordova-plugin-device-motion/pull/45.patch

            To close this pull request, make a commit to your master/trunk branch
            with (at least) the following in the commit message:

            This closes #45


            commit 293dcb9220ac379a9e4cd7776d02969367df6dca
            Author: daserge <v-seshak@microsoft.com>
            Date: 2016-07-06T08:17:17Z

            CB-11531 Restart Accelerometer on CyanogenMod 13

            Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop


            githubbot ASF GitHub Bot added a comment - GitHub user daserge opened a pull request: https://github.com/apache/cordova-plugin-device-motion/pull/45 CB-11531 Restart Accelerometer on CyanogenMod 13 <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> Platforms affected Android What does this PR do? Reset sensor `accuracy` after setting it to `SENSOR_STATUS_UNRELIABLE` in `stop` so that check in `onSensorChanged` passes. What testing has been done on this change? Tested on api22, api23 emulators, api22 device. Checklist [x] [ICLA] ( http://www.apache.org/licenses/icla.txt ) has been signed and submitted to secretary@apache.org. [x] [Reported an issue] ( http://cordova.apache.org/contribute/issues.html ) in the JIRA database [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. [ ] Added automated test coverage as appropriate for this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/daserge/cordova-plugin-device-motion CB-11531 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-device-motion/pull/45.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #45 commit 293dcb9220ac379a9e4cd7776d02969367df6dca Author: daserge <v-seshak@microsoft.com> Date: 2016-07-06T08:17:17Z CB-11531 Restart Accelerometer on CyanogenMod 13 Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop
            githubbot ASF GitHub Bot added a comment -

            Github user cordova-qa commented on the issue:

            https://github.com/apache/cordova-plugin-device-motion/pull/45

            Cordova CI Build has completed successfully.

            *Commit* - [Link](https://github.com/apache/cordova-plugin-device-motion/pull/45/commits/293dcb9220ac379a9e4cd7776d02969367df6dca)
            *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16/)

            Builder Name Console Output Test Report Device Logs
            :---: :---: :---: :---:
            [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/artifact/)
            [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/artifact/)
            [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/artifact/)
            [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/artifact/)
            [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/artifact/)
            githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-device-motion/pull/45 Cordova CI Build has completed successfully. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-device-motion/pull/45/commits/293dcb9220ac379a9e4cd7776d02969367df6dca ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 8.1 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-store/artifact/ ) [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-10-store/artifact/ ) [Windows 8.1 Phone] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=windows-8.1-phone/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=ios/artifact/ ) [Android] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-device-motion-pr/16//PLATFORM=android/artifact/ )
            githubbot ASF GitHub Bot added a comment -

            Github user vladimir-kotikov commented on the issue:

            https://github.com/apache/cordova-plugin-device-motion/pull/45

            LGTM. Just noticed that I've fixed the same issue in #46 :smile:

            githubbot ASF GitHub Bot added a comment - Github user vladimir-kotikov commented on the issue: https://github.com/apache/cordova-plugin-device-motion/pull/45 LGTM. Just noticed that I've fixed the same issue in #46 :smile:

            Commit 293dcb9220ac379a9e4cd7776d02969367df6dca in cordova-plugin-device-motion's branch refs/heads/master from daserge
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device-motion.git;h=293dcb9 ]

            CB-11531 Restart Accelerometer on CyanogenMod 13

            Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop

            jira-bot ASF subversion and git services added a comment - Commit 293dcb9220ac379a9e4cd7776d02969367df6dca in cordova-plugin-device-motion's branch refs/heads/master from daserge [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device-motion.git;h=293dcb9 ] CB-11531 Restart Accelerometer on CyanogenMod 13 Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop
            githubbot ASF GitHub Bot added a comment -

            Github user asfgit closed the pull request at:

            https://github.com/apache/cordova-plugin-device-motion/pull/45

            githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-device-motion/pull/45
            chrilehner CL added a comment - - edited

            Thanks everybody for fixing the issue so quickly! I'll try to reinstall the plugin later today or tomorrow

            chrilehner CL added a comment - - edited Thanks everybody for fixing the issue so quickly! I'll try to reinstall the plugin later today or tomorrow

            Feel free to reopen if this is still an issue

            daserge Sergey Shakhnazarov added a comment - Feel free to reopen if this is still an issue

            Commit 293dcb9220ac379a9e4cd7776d02969367df6dca in cordova-plugin-device-motion's branch refs/heads/1.2.x from daserge
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device-motion.git;h=293dcb9 ]

            CB-11531 Restart Accelerometer on CyanogenMod 13

            Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop

            jira-bot ASF subversion and git services added a comment - Commit 293dcb9220ac379a9e4cd7776d02969367df6dca in cordova-plugin-device-motion's branch refs/heads/1.2.x from daserge [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device-motion.git;h=293dcb9 ] CB-11531 Restart Accelerometer on CyanogenMod 13 Reset sensor accuracy after setting it to SENSOR_STATUS_UNRELIABLE in stop

            People

              Unassigned Unassigned
              chrilehner CL
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: