Software Archive
Read-only legacy content
17060 Discussions

Accelerometer Issue Intel XDK Nexus 4 Android 5.0

Bryan_F_1
Beginner
545 Views

I have code that accesses the accelerometer that works in the emulator and test tabs and on my Note 4 with Android 4.4 but the same code does not work on Nexus 4 with Android 5.0 on it under the App Preview App or with a straight build. The compass works, geolocation works but not the accelerometer. I've tried other example applications with the same result.

0 Kudos
9 Replies
Swati_S_Intel1
Employee
545 Views

Have you checked the Accelerometer plugin (Cordova or XDK whichever you are using)? If you did which one are you using? Cordova or Intel XDK? Which demo app did you try?

Swati

0 Kudos
Bryan_F_1
Beginner
545 Views

I've checked the plugin and in the build page of it for Android, it shows the plugin in the list. I've tried both the Cordova version and the Intel version. I've tried several different demo apps. They all work on my Samsung Note 4 with Android 4.4 but the same code and apk file will not work on my Nexus 4 with Android 5 or 5.1. The Intel version did work once running the app under App Preview, but won't any more.

0 Kudos
Swati_S_Intel1
Employee
545 Views

Are you using legacy build option? If you are then please use Cordova build since the Legacy build is deprecated. If you are using the Cordova build and still having issue, please send your project zip. 

Thanks,

Swati

0 Kudos
Bryan_F_1
Beginner
545 Views

I've tried both the Cordova Build and Crosswalk Build. Same results: runs on Note 4 with Android 4.4 and not on Nexus 4 with Android 5 or 5.1.  Below are the two projects that I've tried. Thanks!

0 Kudos
PaulF_IntelCorp
Employee
545 Views

I have a test app that is illustrating the same problems with Android 5.1 on a Nexus 7. For sometime I thought it was unique to me, so I'm very glad to see I'm not the only one with this issue. I am trying to figure out what is causing this problem, but have not yet found a solution. Will update if I figure this out.
 

0 Kudos
Swati_S_Intel1
Employee
545 Views

Both projects work fine for me on Nexus 9 with Android 5.0.1. First time when you launch your app, it asks you to enable some settings that are not enabled, generally sound and notification settings, but it might be accelerometer settings in your case - just a guess. It didn't ask me about accelerometer setting but did ask about sound and notification and bunch of other.

Swati

0 Kudos
PaulF_IntelCorp
Employee
545 Views

Always fails on my Nexus 7. It used to always work on that device, but since an Android 5 update (not sure which one) it has quit working. I've confirmed that the accel hardware still works, but I think there's an issue with delayed starts or lags that's getting in the way.

There is a Cordova issue filed for that plugin by Microsoft (https://issues.apache.org/jira/browse/CB-8842) that contains some updates to the Android code (https://github.com/MSOpenTech/cordova-plugin-device-motion/tree/CB-8842) which I tried and it did not work. It failed with a Crosswalk build and gave the same non-results with a regular Android build.

Fixing this will likely require some heavy duty debugging with Android Studio and such...

0 Kudos
khin_sin_c_
Beginner
545 Views

Same issue on my device Nexus 4 running on android version 5.1.1

Tested on other device running on KitKat, it work fine. I am using the sample code from this site: https://software.intel.com/en-us/node/492838

 

0 Kudos
PaulF_IntelCorp
Employee
545 Views

A colleague helped to unearth what is going on. This is a Cordova plugin issue. The bug has been reported here: https://issues.apache.org/jira/browse/CB-9339 and a commit has been made to the Cordova plugin here: https://github.com/apache/cordova-plugin-device-motion/commit/b0f8e436efd7d0db586bc2165733ebe5467b8498 -- we're trying to get the Cordova project to issue an update to that plugin.

In the meantime, you can pull-in that version of the plugin and try it, I have not had a chance to confirm that it fixes the problem. It won't work with our current build system, due to changes in the way the Cordova project manages the plugin registry, but it will work with our upcoming release (very soon). You can make it work as a local plugin with the current version of the XDK, by either cloning the head off the master branch of that repo (https://github.com/apache/cordova-plugin-device-motion) or by cloning the specific commit (https://github.com/apache/cordova-plugin-device-motion.git#b0f8e436efd7d0db586bc2165733ebe5467b8498)

And because this forum is going to clip that last URL, remove the spaces from this one to reproduce it:

  • https: // github.com/apache/cordova-plugin-device-motion.git#b0f8e436efd7d0db586bc2165733ebe5467b8498
0 Kudos
Reply