RJBo
RJBo

Reputation: 33

Is this a good way to get distances travelled in moving vehicle throughout the day? Android

I'm making an android app that needs to get the all the distances travelled by a user in a moving vehicle every day. I've been looking into the android APIs, specifically LocationService and my current idea was to get the location of the user every certain number of seconds/minutes and if the distance is increasing by a set amount (enough that it is not just minimal movement) then it determines they're moving and then begins adding their long/lat to an arraylist. Then when the distance between location requests are back to being minimal it stops adding the locations to an arraylist and calculates the distance between all the requests using distanceTo().

However, it seems that Google are restricting the number of location requests every hour and this would render my idea obselete.

Note: On Android 8.0 (API level 26) and higher, if an app is running in the background when it requests the current location, then the device calculates the location only a few times each hour. To learn how to adapt your app to these calculation limits, see Background Location Limits.

What are my other options? Also how would be the best way to determine that the user is in a moving car, or is my idea acceptable?

Thanks in advance for your help!

Upvotes: 0

Views: 61

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128438

I have worked on a OBD chips having different variants like GPS, plugging which will allow you getting accurate GPS data consistently.

Further you can program android application to connect with chip through Bluetooth 2.0 or BLE and can fetch data at decided intervals.

Upvotes: 0

Related Questions