Skip to content

Commit 2b05e5e

Browse files
authored
Update README.md
1 parent 4e05c25 commit 2b05e5e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,52 @@ Use last version from link below (jitpack):
2121

2222
[![](https://jitpack.io/v/maddevsio/mad-location-manager.svg)](https://jitpack.io/#maddevsio/mad-location-manager)
2323

24+
## How to use
25+
There is example application in current repository called "Sensor Data Collector" .
26+
27+
### KalmanLocationService
28+
29+
This is main class. It implements data collecting and processing. You need to make several preparation steps for using it :
30+
1. Add to application manifest this :
31+
32+
```
33+
<service
34+
android:name="mad.location.manager.lib.Services.KalmanLocationService"
35+
android:enabled="true"
36+
android:exported="false"
37+
android:stopWithTask="false" />
38+
```
39+
2. Create some class and implement LocationServiceInterface and optionally LocationServiceStatusInterface .
40+
3. Register this class with ServicesHelper.addLocationServiceInterface(this) (do it in constructor for example)
41+
4. Handle locationChanged callback. There is Kalman filtered location WITHOUT geohash filtering. Example of geohash filtering is in MapPresenter class.
42+
5. Init location service settings object (or use standard one) and pass it to reset() function.
43+
44+
#### Important things!
45+
It's recommended to use start(), stop() and reset() methods, because this service has internal state. Use start() method at the beginning of new route. Stop service when your application doesn't use locations data. That need to be done for decrease battery consumption.
46+
47+
### Kalman filter settings
48+
49+
There are several settings for KalmanFilter. All of them stored in KalmanLocationService.Settings class.
50+
51+
- Acceleration deviation - this value controls process noise covariance matrix. In other words it's "trust level" of accelerometer data. Low value means that accelerometer data is more preferable.
52+
- Gps min time - minimum time interval between location updates, in milliseconds
53+
- Gps min distance - minimum distance between location updates, in meters
54+
- Sensor frequency in Herz - the rate sensor events are delivered at
55+
- GeoHash precision - length of geohash string (and precision)
56+
- GeoHash min point - count of points with same geohash. GPS point becomes valid only when count greater then this value.
57+
- Logger - if you need to log something to file just implement ILogger interface and initialize settings with that object. If you don't need that - just pass null .
58+
59+
There is an example in MainActivity class how to use logger and settings.
60+
61+
### GeoHashRTFilter
62+
63+
There are 2 ways of using GeoHash real-time filter :
64+
* It could be used as part of KalmanLocationService. It will work inside that thread and will be used by service. But then you need to use start(), stop() and reset() methods.
65+
* It could be used as external component and filter Location objects from any source (not only from KalmanLocationService). You need to reset it before using and then use method filter() .
66+
67+
It will calculate distance in 2 ways : Vincenty and haversine formula . Both of them show good results so maybe we will add some flag for choose.
68+
69+
2470
## The roadmap
2571
### Visualizer
2672

0 commit comments

Comments
 (0)