I am creating application that has endless ForegroundService
for new android versions.
Problem is that ForegroundService
always dies after some time no matter what.
Tried to do Battery optimization
, Wake lock
, creating new process
for service, even creating JobScheduler
that checks if Service
still working, but that one also stops working after some time.
Tried to follow Google samples
, Stackoverflow
solutions and many others, nothing seems to work.
I also made some research on my banking app and some other apps that relies on services for notifying the user or tracking some activities, they also not working flawlessly like old times.
At the end I figure out that for some Vendor
phones doing some extra setting Vendor specific setting helps, this link one of many examples to understand Slack Known issues with Android .
After this reading, I don't think that simple user should go somewhere in to deep phone setting to make app that he likes to work... In fact I think it is the worst practice....
Made some conclusion after researching that because of saving few battery percents Google and poorly made Vendors battery saving strategies on top making phones dump and not reliable....
Also these background restrictions making not possible to develop awesome pocket portable device features...
I mean I agree with ForegroundService
idea for long running task instead of simple Service
in background that might be malware, spying or whatever that user does know nothing about it. Also agree that User is notified about high power usage, but randomly killing everything is same as killing the idea of smart device
.
Please tell me that I am wrong about everything and give me a solution :)