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 Ionic Device Motion Plugin
- The Device Motion Web API that is supported by browsers
- The Generic Sensor API that is documented to be supported by Chrome browser
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?