Currently, the Android application for enviroCar can record tracks only when it is connected to the OBD-II adapter through Bluetooth. The enviroCar app will be of no use to the user, if he/she does not have a working OBD-II adapter or if Bluetooth is not working on the user’s mobile phone. This limits the usage of the app to a great extent. The main goal of this project is to add plain GPS-based recording of a track to the enviroCar Android application. This will increase the usability of the enviroCar app and simultaneously increase the collection of data on the enviroCar server. It is also equally important to automate the GPS-based track, for which Activity Recognition features can be used.
The previous blog post covered the work done in the first half of the GSoC, which mainly focused on updating libraries, implementing new design and implementing GPS-based track recording. However, the upcoming sections of this blog post focus mainly on the work done in the second half of the GSoC project. This deals mainly with implementing automatic track recording features for GPS-based track recording. The core tasks and considerations during the GSoC period can be summarized as follows:
- Update the libraries used in the repository to the latest versions.
- Change the user interface of the application to ensure that it is following material design guidelines.
- Implement Plain GPS-based track recording procedure.
- Implement an Automatic procedure for recording GPS-based tracks using Activity Recognition Transition API.
- Verify the start of GPS-based track and automatically stop GPS-based track if the track does not satisfy the requirements needed, by using Activity Transition API.
The main project repository can be found here: https://github.com/enviroCar/enviroCar-app
Implement an automatic procedure for recording GPS based tracks using Activity Recognition Transition API
Plain GPS-based track recording is implemented in the application. It is equally important to implement a procedure to automatically start/stop the GPS based tracks. This improves the user-friendliness of the application. The best option available to automate GPS-based tracks is to use Activity Recognition features. After a study on available Activity Recognition libraries, we decided that Google’s new Activity Transition API is the most suitable one for our use case. This API provides updates whenever it detects any change in the user’s activity, which is what we needed. So we decide to test the reliability, latency, and efficiency of the Activity Transition API to determine whether or not to use the library in the application.
I thoroughly tested the Activity Transition API on 4 different devices. The test results are detailed in this document. After analyzing the test results, I came to the conclusion that the Activity Transition API is reliable enough to use in our use case. Latency of the transition is found to be 110 seconds.
I added two preferences for Automatic GPS-based track recording, namely Auto Start Background Service and Auto Start GPS based track. Both preferences have a similar meaning to that of the preferences present in Automatic OBD track recording. The Auto Start Background Service preference starts the Automatic GPS Service and displays a notification showing the current state of the GPS-based track recording whenever GPS is turned ON. This doesn’t use any Activity Recognition features. The Auto Start GPS-based track preference uses Activity Recognition features. It starts the GPS-based track automatically whenever it detects that the user is IN_VEHICLE. The two different preferences were used separately for both Automatic OBD and GPS track recordings.
Verify the start of GPS-based track and automatically stop GPS-based track using Activity Transition API
Previously, GPS-based tracks could be started whenever GPS was turned ON. However, there was no verification that the track was running while the user wass driving. This could generate many unnecessary tracks. So adding a verification for starting GPS-based tracks is necessary. I found that the best way of adding the verification is to use Activity Recognition features. So Activity Transition API is used here to verify that track is started only when the user is IN_VEHICLE. In the same way, GPS-based tracks will be automatically stopped when we find that the user has stopped driving. Track data collected while a user isn’t driving is of no use.
Apart from the technical stuff, new screenshots were designed for display in Google Play Store which can be accessed here. Some of them were as follows :
It was a thirteen weeks journey of learning new things and having new experiences. I would like to thank my mentors Arne de Wall and Christoph Stasch for their valuable time with me. Especially, I want to thank Arne de Wall for his constant support and guidance. I really enjoyed working under his guidance. Coming to the project, I think I have completed all the goals set by me in the initial proposal. I hope that my contributions make some difference in the evolution of the enviroCar project.