[TIMOB-26947] Android: Foreground Services do not work reliably
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Hold |
Resolution Date | 2019-04-22T17:32:09.000+0000 |
Affected Version/s | Release 8.0.0, Release 7.3.1, Release 7.5.1, Release 8.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, engTriage, foreground, service |
Reporter | Hans Knöchel |
Assignee | Abir Mukherjee |
Created | 2019-03-28T13:16:23.000+0000 |
Updated | 2019-04-22T17:45:05.000+0000 |
Description
One of our technology customers is using a module we built for them that utilizes foreground-services (7.3.0+) and the location provider API to record geolocations and it seems to randomly fail:
{quote}
In the foreground, the tracking on all devices under Android 7 and Android 8 delivered sufficiently accurate results. On a Galaxy S5 under Android 6 no geo data could be recorded. If the app is running in the background, the results are very different. On Huawai Devices, the Foreground service is often terminated - this happens very differently, sometimes after 16 minutes, sometimes even for the first time.
after 50 min. A Google Pixel 2 with Android 8 behaved similarly. The least problem with the Foreground service seems to be on Galaxy devices.
{quote}
We hope this can be resolved by some fine tuning.
The following community module attempts to keep the app alive by having the Android
AlarmManager
poll it at regular intervals (as I stated above in my last paragraph above). This should work, but spawning a wake-lock every interval via theAlarmManager
is frowned upon... unless your app "really" needs it. https://github.com/AppWerft/Ti.Watchdog