xfarrow / locatemydevice

Application miming Google's Find My Device through SMS
GNU General Public License v3.0
109 stars 11 forks source link

Background service dies after short period despite disabling all optimizations #14

Open maloryware opened 6 months ago

maloryware commented 6 months ago

Platform: Xiaomi Redmi Note 12S OS: LineageOS 20.0 (Unofficial port for Redmi Note 12S) Issue: After ~30 seconds of exiting the app, the service stops running altogether, causing the app to not function at all. I'm aware Xiaomi is very insistent and annoying with its battery-saving policies, but I've just about tried everything I could to have it not die after a few seconds. Unrestricted battery usage, all permissions it could need, battery manager disabled. Currently attempting to set up "Automation" with a rule to auto-start it every 30 seconds, which is definitely going to melt my battery, but is the only replacement I could think of.

xfarrow commented 6 months ago

Hi @maloryware , I am sorry to hear that. I have a Xiaomi Note 11S and it does work well, I am then unsure what the problem could be. What about "pinning" the app in the recent apps? I personally did not do that, but it should not occupy too much memory. In any case, I will investigate the problem.

Thank you for your patience.

maloryware commented 6 months ago

Hey, thank you for the speedy reply! While MIUI HyperOS has that functionality, LineageOS doesn't seem to - or at least the fork I'm using (which is, unfortunately, for the time being, the only one available for the 12S) I'm not very well versed in how Android apps work, and attempted to delve into the app's source code to see if there was a service I could start every 30 seconds, or prioritize, but the only thing keeping the app alive is a cached background process. image I honestly don't know how difficult this is, as my development experience with Android is very limited, but I believe starting a service associated to the app should fix the problem

xfarrow commented 6 months ago

Oh thank you for the huge help, this could indeed work. To be honest I am not super accustomed to Android development either, I'll try to research and deep into it!

maloryware commented 6 months ago

Glad to be of assistance, let me know if there's anything I can do!