Good day,
situation:
I'm developing Android application that serve as sport tracker/navigation app - so it require permanent connection to GPS and also permanent awake device. Recording is done every second.
Current solution working for years is thanks to wakelocks
that keep device awake.
Doze mode in Android 6.0+ complicate situation, but it is not this case.
On Huawei device is probably different type of optimization.
Here is part of log:
10-10 10:33:18.462 1014-384 D/PFW.HwPFWAppWakeLockPolicy: getUidWakeLock uid: 10097 wakelock >= 10 mins
10-10 10:33:18.543 1014-384 D/PFW.HwPFWAppWakeLockPolicy: force stop abnormal wakelock app uid: 10097
10-10 10:33:18.558 1014-384 I/ActivityManager: Force stopping menion.android.locus appid=10097 user=0: from pid 1014
So after approx. 30+ minutes, system simply decide that app use too much wakelocks
and terminate it completely with all services, history, simply kill
.
Any experience with this behavior and any suggestion, how to this simple task (permanent recording of GPS location when screen is off) better?
As I wrote at start, on all other devices except new Huawei, such system works correctly for many years.
EDIT: note after comment of one user (deleted?), "whitelist" app in Huawei battery manager (mark as "protected application") has no effect on this problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…