[Bug] Accelerometer does not respect alwaysOn [answered]
In my Pedometer project, I need the accelerometer to stay on, even when the screen is off.
Code example:
Accelerometer {
id: accel
dataRate: 100
alwaysOn: true // <====
onActiveChanged: canvas.requestPaint();
onReadingChanged: { ... }
}
The manual states:
alwaysOn : bool
This property holds a value to indicate if the sensor should remain running when the screen is off.
Some platforms have a policy of suspending sensors when the screen turns off. Setting this property to true will ensure the sensor continues to run.
But even though I have alwaysOn set to true, the onReadingChanged does not fire when the screen is off!
Ah, that's the reason. I like the Pedometer but ran into this issue.
lispy ( 2015-02-23 09:00:35 +0200 )editGood question Kim! Please tell us if you find a solution. I will start working with an application that requires this feature at some point when I have time. By the way, your pedometer looks great!
pekkeli ( 2015-02-23 20:57:20 +0200 )editI'll add a comment here as soon as I have a verified solution.
Kim ( 2015-02-24 01:45:59 +0200 )editKeepAlive did indeed solve the problem. I had some problems finding out how to install and distribute it, but discovered that KeepAlive is distributed with the OS! All I had to do was:
Keepalive isn't known by QTCreator, so the include will be marked as unknown, but on the device it works!
Kim ( 2015-03-03 23:40:29 +0200 )edit