Create Data Collector
To use the Data Collector service and its features, the DataCollectorService needs to be initialized and a DataCollectorClient instance needs to be created. The initialize()
method will only need to be called once.
Data Source is an optional and configurable component of Data Collector provided to facilitate generation of data from various datasources such as “android”, “vehicle”, “OBD”, etc. This component will help generate and send event data to the Data Collector component.
Create Data Collector Client
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Warning
Since release version later than 1.4.10.81, a limitation has been introduced that the initialize()
method cannot be called in the main thread.
Warning
The fields ApiKey, ApiSecret, CloudEndPoint, SdkCacheDataDir, UserId, DeviceGuid, ApplicationInfo of SDKOptions must be populated as they are mandatory for data collector functionality.
Create DataSource
Create DataSource with trip detection
1 2 3 4 5 6 7 8 9 10 11 |
|
1 2 3 4 5 6 7 8 9 10 11 |
|
Create DataSource without trip detection
1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 6 7 8 9 |
|
Warning
DataSource must be created after DataCollector is created.
Note
Data Source supports collecting GPS probe data at a configurable interval (default 1Hz). please refer to Release Notes and Best practices to get latest information. In future Data Source will be enhanced to support other sources of data.
Note
Data Source requires permissions which must be configured in the Android App's AndroidManifest.xml
.
- android.permission.ACCESS_FINE_LOCATION
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.ACCESS_NETWORK_STATE
- android.permission.INTERNET
In addtion, when the app first starts, a notification may popup to ask the user to grant permission to access GPS data or else lat/lon would always be 0,0
The SDK is now ready to use!