Daniel-White Active Member Licensed User Longtime User Jul 4, 2017 #1 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., usually the end user will not discover the problem is the "Battery Manager".
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., usually the end user will not discover the problem is the "Battery Manager".
Daniel-White Active Member Licensed User Longtime User Jul 4, 2017 #2 I will answer myself, I found this https://stackoverflow.com/questions...phones-and-how-to-handle-it/35220476#35220476 One idea, put a code inside of my APP to detect the brand of the phone if Brand _of_ the_phone = "Huawei" show a dialog to explain how too proceed with "Battery Manager" manually. Plop!!!!, well, we can close this thread, I guess. Upvote 0
I will answer myself, I found this https://stackoverflow.com/questions...phones-and-how-to-handle-it/35220476#35220476 One idea, put a code inside of my APP to detect the brand of the phone if Brand _of_ the_phone = "Huawei" show a dialog to explain how too proceed with "Battery Manager" manually. Plop!!!!, well, we can close this thread, I guess.
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2017 #3 Have you tried to use a foreground service? Upvote 0
Daniel-White Active Member Licensed User Longtime User Jul 8, 2017 #4 Erel said: Have you tried to use a foreground service? Click to expand... Brilliant, work great. Erel. Much obliged. Upvote 0
Erel said: Have you tried to use a foreground service? Click to expand... Brilliant, work great. Erel. Much obliged.
Daniel-White Active Member Licensed User Longtime User Jul 8, 2017 #5 Daniel-White said: Brilliant, work great. Erel. Much obliged. Click to expand... 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. I cannot escape. I did my lab with LG and Huawei, everything ok in LG. Upvote 0
Daniel-White said: Brilliant, work great. Erel. Much obliged. Click to expand... 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. I cannot escape. I did my lab with LG and Huawei, everything ok in LG.
Erel B4X founder Staff member Licensed User Longtime User Jul 9, 2017 #6 This is the expected behavior. You can acquire a partial lock with PhoneWakeState to keep the CPU running. Upvote 0
This is the expected behavior. You can acquire a partial lock with PhoneWakeState to keep the CPU running.
Daniel-White Active Member Licensed User Longtime User Jul 9, 2017 #7 Erel said: This is the expected behavior. You can acquire a partial lock with PhoneWakeState to keep the CPU running. Click to expand... 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
Erel said: This is the expected behavior. You can acquire a partial lock with PhoneWakeState to keep the CPU running. Click to expand... 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.
Erel B4X founder Staff member Licensed User Longtime User Jul 10, 2017 #8 Daniel-White said: I don't know, perhaps if I try with sticky service? Click to expand... It doesn't matter. Foreground service > sticky service. I guess that Huawei decided to ignore the partial lock. Upvote 0
Daniel-White said: I don't know, perhaps if I try with sticky service? Click to expand... It doesn't matter. Foreground service > sticky service. I guess that Huawei decided to ignore the partial lock.