I am making an app that allows users to search for nearby users of my app, so I need to update users' location periodically, and this process should be triggered even when the app is closed. I have read about the limitations of background location, but I can't think of another way to do this. I have searched if I could implement this using pending intent or broadcast receiver, and I tried fused location provider, but nothing worked for me. I am fairly new to android and I am creating the app using flutter, and currently I am using a foreground service for this, but this keeps a notification fixed and is battery consuming. So what is the best way to achieve this? and is it possible when app is closed? or is there a better way to do this? I was wondering about facebook service "nearby friends" which is similar to what I am trying to achieve, but I am not sure what they could've used to implement it.
Asked
Active
Viewed 439 times
0
-
It's difficult. App will be killed when you will close it. If you dont keep a permanent notifications. Custom skins like MIUI/Samsung one UI. Doesn't even respect permanent notifications, they will kill your app no matter what you do – Nikhil Badyal Apr 19 '21 at 14:03
-
Yes I noticed that on MIUI, but I believe there are apps that use what I'm trying to achieve, but I wonder what they could possibly use. – Samer Alkhatib Apr 19 '21 at 14:17
-
Which app does this ? I dont think any app can do this in background. OS just kills the app. Even fb can't do this – Nikhil Badyal Apr 19 '21 at 14:19
-
I'm not sure actually, I just assumed, and with newer android versions the limitations increased a lot. Anyway I will try to use work manager or alarm manager and see if I get satisfying results. – Samer Alkhatib Apr 19 '21 at 14:24