Reading accelerometer data while the app is running in background

I want to build an Ionic app that can still use accelerometer data while the app is minimized (runs in the background).

I have tried using:

The first two work in the foreground but won’t work while the app is in the background (the accelerometer readings are paused and are resumed while on the foreground again). The Generic Sensor API won’t work at all, even if I use this polyfill: https://github.com/kenchris/sensor-polyfills

I have also tried the Ionic Background Mode plugin, however, the accelerometer reading are still being paused in background. https://ionicframework.com/docs/native/background-mode

How can an Ionic app use the accelerometer while in background? Any plugin that I am not aware of its existence (e.g., the Ionic Background Geolocation lets the app receive locations while in background)? Any other way?

Did you find some solution? I think that best way is to implement a plugin by yourself and for to be in foreground