Android pragmatically get vehicle status

113 views Asked by At

In my application i need to find the vehicle status, i can get speed of vehicle using location manager but many article told that getting speed from location manager is not accurate, can anyone suggest me

  1. which method is best to find vehicle status

  2. can i use geofence method to identify my vehicle status

All suggestion are welcome

Thanks

1

There are 1 answers

1
gsb On BEST ANSWER

What do you mean by vehicle status?

If you mean speed, you can do the following:

  1. Detect when the user is in a Vehicle using ActivityRecognition to DetectActivity
  2. As soon as you detect the user is moving in a vehicle, keep a track of the Location and Time.
  3. Whenever you find a new location, calculate the distance between the last location and the new one using distanceTo(Location). Also calculate the time difference. Your speed at this point will be distance / time.

You can keep repeating this for every new location you find and you will have the speed of the vehicle. You can read more about Android LocationStrategies.