Android Question Destroyed service, never starts again

nicolino33

Active Member
Licensed User
Longtime User
Hello all, in some huawei smartphone with android 6.0 B4A services are always stopped as soon as you close the app, while those like whatsapp, lovoo, and other chats remain active, why? What should I insert in the manifest to leave the service always active? I also tried with stiky, I tried to reactivate the service even in the sub destroy, but nothing to do, when I close the app the service stops working and never start again.
 

nicolino33

Active Member
Licensed User
Longtime User
my service and my app work perfectly, I only have problems with the huawei P8, all other devices work perfectly, the services remain active and do not lose a package!

My question was very simple: is there a way to keep always active service on the huawei P8? (without using the push..., maybe with some loop of intent, maybe intercepting the moment the service is interrupted)
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
It depends witch operation system you use. However the whit b4a 8.3 and oreo ,the starter service is never killed until the process is alive. You can check periodically into that service if your service is still active and start it.

I have solved into a project where my app was always on top ( android TV box used as server) following an Erel council , I create another app as a watchdog and every 2 minute that app send a start command to my server app, in that way my app is always alive 24/7
 
Upvote 0

nicolino33

Active Member
Licensed User
Longtime User
Yes, I did it, but the huawei P8 does not work, as soon as the user presses the power button to put the phone on standby, the process is killed, and then the socket that runs on a service no longer receives messages. I also tried to do another service that checks every 2 minutes if the primary service is active, this solves the problems on other phones, but on the huawei P8 also killed this, this and primary service. I have look in huawei setting and is all ok, I don't find one solutions.

PS.
I use B4A 8.30
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Nicolì, I have huawei mate 10 and i got that behavior when I use b4a bridge ,I solved with the power management setting , you have to set manual management ,see this :
Screenshot_20180621-225413.jpg

After change this setting it should works.
 
Upvote 0

nicolino33

Active Member
Licensed User
Longtime User
Ma sei italiano? :) ci provo è, sono 4 giorni che sto impazzendo con un cliente…. Ma mi dice che ha già autorizzato nell'alimentazione, magari ha lasciato indietro qualche spunta… grazie!
 
Upvote 0

nicolino33

Active Member
Licensed User
Longtime User
test push on huawei P8 fail! All other devices receive the push notify, but huawei P8 no, when put it in standby do not receive… Why?
 
Upvote 0

nicolino33

Active Member
Licensed User
Longtime User
but have you read what I wrote ?

I repeat: I have activated push notifications with firebase, in huawai P8 they do not work! I have 6 devices in which they are active, they work in all 6 devices except in huawei!
 
Upvote 0

nicolino33

Active Member
Licensed User
Longtime User
already insert in whitelist, the push firebase work correctly in all other device, the problem is only of huawei p8.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The whole point of push notifications is that the process doesn't need to run for your app to receive messages. See the video tutorial.
Erel, are you sure about this? I tried (very simple test, using your code, except the app name) and if I stop my app by settings and send a FCM message (I used your b4j example to do this) the app does not starts.
 
Upvote 0
Top