Android Question Huawei stop background services

Daniel-White

Active Member
Licensed User
Longtime User
I noticed the Huawei have "Battery Manager" and I need to tell him do not stop the specific APP when the phone sleep. Here another guy explain the same
https://www.b4x.com/android/forum/threads/huawei-p7-app-protect.66687/#post-422018
The problem, it is very specific in Huawei phones.

My question can be possible to override that parameter of "Power manager" programmatically, my concern is the user download my APP, it will not work because of the "Battery Manager" sabotage it.:mad:, usually the end user will not discover the problem is the "Battery Manager". :confused:
 

Daniel-White

Active Member
Licensed User
Longtime User
Brilliant, work great. Erel.
Much obliged. :)

PS: I noticed the service is paused when the Huawei go to sleep. However with the Foreground service works fine when the phone keeps awake. so it is an improvement. before it does not work as a normal service, now the weird is when the phone goes to sleep, pause the service. and when I awake it manually (pressing the turn on the button), the service continues.

I think it will be a must indicate manually to "Power Manager" allow the APP works in the background. :confused: I cannot escape.

I did my lab with LG and Huawei, everything ok in LG.
 
Upvote 0

Daniel-White

Active Member
Licensed User
Longtime User
This is the expected behavior. You can acquire a partial lock with PhoneWakeState to keep the CPU running.
You read my mind, I tested that, I put the "partial lock" inside of the service, but when the phone goes to sleep, the service goes to pause. and when I press "the physical power button" the service continue and the logs show "something is already in the partial lock". I am using the servicestartat, I don't know, perhaps if I try with sticky service? I will try. Of course if I setup in the "Power Manager of Huawei it always works fine.!

Thanks, Erel.
 
Upvote 0
Top