Accelerometer Sensor is not working in background

Hi all,
I tried UrsAI2KeepAlive extension and it's working fine using Pedometer (i.e.), but when trying to use it with Accelerometer sensor then it's not working. I mean, when the app is in background (kept alive by the UrsAI2KeepAlive extension), Accelerometer events seem to not work. My app's goal is to generate an alarm sound (text-to-speech) when mobile is being shaken (Accelerometer zAccel > threshold).

Do you know how to fix it?

Thanks a lot in advance!
Luis.

Welcome to the community
Probably it is the alarm sound, which does not work in the background? Did you try to store the zAccel values in TinyDB to find out, if the Accelerometer works in the background?
You also can try to remove battery optimization in the settings of the app to see if this makes a difference. .

Taifun

Is it enabled? If not then you might need to.

Hi Taifun, thanks for your answer!
Alarm sound works with Pedometer events, so I guess this is not the problem.
I've checked that Accelerometer.AccelerationChange Event doesn't work in background.

BR,
Luis.

Hi Zavier, yes it is enabled, but for any reason Accelerator.Acceleration Change event doesn't work in background.

BR,
Luis.

Try a clock component and check the ZAccel property of the sensor regularly

Taifun

Already tried. Accelerometer foesn't refresh its values X/Y/Z when it is in background mode :frowning: