Dash cameras are the most objective eyewitnesses on the road. The more drivers use dash cameras, the safer our trips and daily commutes are. Open Dash Cam was born with the idea of making dash camera accessible and available to anyone with a smartphone to make driving safer and responsible. It is a project by community for community.
There is a number of dash camera applications out there, but all of them take up entire screen that most drivers need for navigation, Uber or other applications that provide helpful on-screen information during the commute. The idea behind Open Dash Cam is to create a minimally-intrusive on-screen widget, that will leave the major part of the screen to any other application the driver chooses to use.
Open Dash Cam is a dash camera widget, that is drawn over other apps, allowing users to record videos in background while using other apps, such as navigation.
The core functionality of the application is performed by two services: WidgetService, which draws the widget icons over other apps, and BackgroundVideoRecorder, which records videos in background and rotates them.
The way application works is the following:
- User starts the app
- Permissions are checked
- Some navigation app is started in background (see function here)
- WidgetService and BackgroundVideoRecorder services are started.
This service continuously records video in pieces of specified length in the background, using the rear (primary) camera, and saves them in dedicated application directory. Once the directory size reaches specified quota, the videos get rotated (oldest one gets deleted to create space for a new one).
When a new recording starts, we save the current and previous recording filenames in the database. We need this so that when users select "Save recording" we will mark the videos as "starred", so that they are not deleted during rotation.
When the video reaches specified length, we let MediaStore Content Provider know about the new file, and repeat the recording process.
This is a browser for videos recorded by the app, built as a Recycler View. We get arraylist of recordings by querying MediaStore populating the list with Recording objects.