cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse <>
Subject Re: Device-motion plugin test failures on Android
Date Thu, 14 May 2015 17:11:27 GMT
I would retrieve the values once on start, and subscribe for updates. 
Cache the latest value and pass it to js either when it changes or when the 2 seconds is about
to expire. 

> On May 14, 2015, at 9:46 AM, Alexander Sorokin (Akvelon) <>
> Hi, community.
> I am investigating device-motion plugin test failures on Android and I've found that
if the device (or emulator) is still, no SensorChanged events is being raised. So the plugin
adds accelerometer listener, waits for two seconds (no updates), removes accelerometer listener
and then calls fail callback.
> I've come up with three different approaches to solve this problem:
> 1. We can pend the tests for Android.
> 2. We can save latest accelerometer value and pass it if no SensorChanged events is fired
in 2 secs. But this value can be outdated.
> 3. We can poll accelerometer continuously and don't add/remove listener. But I believe
that this approach can drain device battery.
> What do you think, guys? Which way is best for us?
> Thanks,
> Alexander Sorokin
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message