This app is built for the purpose of collecting road driving data from drivers. It was built as part of a PhD research project for to collect data from drivers in Nigeria. It uses mobile phone sensors to collect telematic data such as acceleration, speed, address etc.
This repository contains the source code for the TelmaticsApp, a mobile application designed to collect real-time driving data using mobile phone sensors. The app collects data at the rate of 200Hz per second and is designed to be used by drivers. This readme file provides an overview of the codebase, its structure, and instructions for using and running the code.
Screenshots of the App are in the Images folder
The TelmaticsApp codebase is organized into several packages, each serving a specific purpose:
- This package is expected to contain services that query external databases, but it's not yet fully implemented in the current version of the code.
The current version of the app only have a local database created and managed on the phone, the database settup and other related data are in this package. It
- Contains Data Access Objects (DAO) and defines the database schema.
- Which Includes the following DAOs:
- DeviceDAO
- LastKnownPointDAO
- LawEstablishedDAO
- LoginAPIResponseDAO
- PointDAO
- SensorDataDAO
- TrackDAO
- TripDetailsDAO
- UserAPIResponseDAO
- These DAOs are organized in a subpackage called
DataAccessObjects
. - The package also holds data model definitions for the above data access objects.
- Defines data access points across the application.
- This package plays a pivotal role in handling data interactions and repositories.
- Contains the logic for handling sensors and location services.
- This is where data collection and sensor-related functionalities are implemented.
- Includes the
Resource
file, which tracks the state of resource access operations. - Contains a file called
LocationMethods
that defines how correct addresses for given locations are processed and returned.
- Collectively encompasses all the above-mentioned packages related to data management and services.
- Contains
repository
andusecase
packages, which are essential for data management and business logic.
- Includes
di
(Dependency Injection) andui
packages. viewModel
package holds view models essential for the user interface.
- Serves as the entry point to the application.
To use or run the code, follow these steps:
- Clone this repository to your local machine.
- Open the code in your preferred integrated development environment (IDE).
- Ensure you have the necessary dependencies and SDKs installed for mobile app development.
- Build and run the application on an emulator or a physical device.
The Follow steps gives a detailed how to run of the TelmaticsApp code:
-
Clone the repository to your local machine from the GitHub repository:
- Repository URL: https://github.com/iniakponode/TelmaticApp.git
-
Download and install Android Studio:
- Download Android Studio from here
-
Open the TelmaticsApp project in Android Studio:
- Launch Android Studio on your machine.
- Use the 'File -> Open' option from the top-left corner of Android Studio.
- Locate and select the folder where you cloned the TelmaticsApp repository and open the project.
-
Run the application:
- Click on the green play button (Run button) located at the top-right corner of Android Studio.
- This will build and launch the TelmaticsApp on an emulator or a connected Android device.
-
Using the Application:
- Once the app is running, click on the "Start Trip" button. It will change to "Stop Trip" to indicate that the app has started recording a trip.
-
Simulate Movement:
- If using the Android Studio emulator, you can simulate movement by using the emulator's rotate feature located at the top left corner.
-
Database Inspection:
- You can view live sensor data in the database using the app inspection tool in Android Studio.
- To access the database inspector, go to "View -> Tool Windows -> Database Inspector".
- Wait for the database to load, then scroll to "telmatic_db," click to expand it, and you will see all the tables in the database.
- The two most important tables are "sensor_data" and "trackpoint," which store trip data at a rate of 200Hz.
- You can change the data collection rate by editing the value in the "SensorDataFromHardwareImpl.kt" file located at "data/repository/datasourceImpl/".
-
Data Extraction:
- To extract the data, right-click on the "telmatic_db" in the database inspector.
- You can export the data as SQL or CSV files and save it to your desired location for further processing.
-
Trip Influence Factor Data:
- Drivers can report trip influence factor data using the form that appears after clicking the "Stop Trip" button.
- This data is saved in the "track" table.
- You can extract this data in the same way as described above. The two sets of data are connected by the "trackId."
-
Generating APK:
- You can generate an APK file for installation on your Android phone.
- Connect your Android phone to your computer with a cable or via a hotspot connection to Android Studio.
- Ensure that the developer options on your Android phone are enabled.
- Build and generate the APK file and install it on your Android phone.
-
Anyone can join the app testing group here: https://play.google.com/apps/internaltest/4701382368637554521 to test the app
Please note that the code is still a work in progress, and some features, such as external database interactions, may not be fully implemented in the current version.
For any questions or assistance, please contact the author of this code.
Thank you for reviewing the TelmaticsApp code. If you have any further questions or need additional information, please don't hesitate to reach out to the author.