Reputation: 886
First of all, I am a Windows (C#) programmer and I developed only a few very simple mobile applications before and a few years passed since then.
Now my customer asked to track his employee via his Android phone (because the employee carries valuable assets like gold and money) and he thinks this will help the security issues. All I need is to develop an Android application that will run as background service (and continue to run even if employee switches to another application or minimze* it) and upload the current GPS location (FINE_LOCATION) to my client's server in every XX minutes so he can see him on the map (on his Windows machine - I can easily handle that part)
Note that about the employee denying the requested permissions is not an issue here. He is aware that I won't be responsible for that.
I know this question has been asked before many times but all of them seemed way too old and I just want to be sure about the compabilitly and the power consuption issues.
So, -as of August 2020- what is the most efficient and correct way to do this ?
There are lots of background tasking ways and lots of location achieving techniques and I'm just not sure what is the most updated ways.
Any help would be appreciated.
Upvotes: 0
Views: 201
Reputation: 74066
You need a Service
that runs in the foreground
then you can use the Fused Location API to request location updates
Also note that the user can easily reject location permissions for the app nd not send you their position so you need to be aware of that
Upvotes: 1