I need for my app an service that tracks the phones location all the time. Its used to create a path that the user traveled, will be displayed in the app and should be distinguishable between walking and other means of movement. The location should be of high accuracy combined with timestamps and speed and saved in an sql lite db for further use in my app.
What is the best way to tackle this problem? I encountered that background services weren't able to get the location often enough. My last resort would be to make it a foreground service but maybe someone has already a solution to this problem. (e.g. is it possible to get the location data google keeps track of in a usable format?) Thanks in advance!
Edit: I am sorry that i wsant clear enough. The problem is that during my research i found out that there were several ways to get the data needed. The location manager and fused locoation. All of these are limited by how often you are allowed to gain GPS data when the service runs in background, which might reduce the path accuracy. Some solutens were to make it a foreground service so it wont suffer from the same limitations, but that isnt something i want to implement.
To formulate a more precise question: What is the best way to collect accurate(!) GPS location data over a long time using a background service while not draining too much energy? It could also be in batches, as it isnt used in real time but to evaluate later.