@freqsc wrote:
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
https://ionicframework.com/docs/native/device-motion- The Device Motion Web API that is supported by browsers
https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent- The Generic Sensor API that is documented to be supported by Chrome browser
https://developers.google.com/web/updates/2017/09/sensors-for-the-webThe 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?
Posts: 1
Participants: 1