How can we create an app that automatically responds to a message for a driver, so they don't lose focus or get into a serious accident?
Texting and driving causes drivers to lose focus and it causes accidents. This can sometimes lead to the death of the driver, any passengers, or the occupants of the other car(s). To help solve this dangerous issue, we need to make an app that drivers can use to minimize phone usage. Our app will have an automatic message that will be sent to anyone that texts the user while the app is running. The user will be able to customize their message as well, which will be stored in a database. The user can also choose to have an active text to speech component, which speaks the incoming message aloud.
Laptop, Emulator for MIT AI2 Companion, MIT App Inventor, Other Online Resources
1) Create a new project on MIT App Inventor (NoTextingWhileDriving_SarahKeyaJoshua)
Designer View
2) Add a horizontal arrangement and place a Label (ResponseMessageLabel) and Button (EditButton) inside the arrangement
3) Change the text on the button to "Edit"
4) Add another horizontal arrangement (MessageInputForm) and place a Text Box (Response Input) and Button (Submit Button) inside the arrangement
5) Change the text on the button to "Submit"
6) Add a checkbox (TextToSpeechBox) and change the text to "Speak Incoming Text Aloud"
7) Add a Button (ResetButton) and change the text to "Reset"
8) Add the following non-visible components: TextToSpeech1, Texting1, TinyDB1, Notifier1, Notifier2
Blocks View
9) Take out the Screen1.Initialize event handler and add the Set ResponseMessageLabel.Text to block
10) Then, call TinyDB1.GetValue, attach a text string to the 'tag', and type "responseMessage"
11) For the valueIfTagNotThere string type "I'm driving right now, talk to you later!"
12) Set the MessageInputForm.visible to false under the Screen1.Initialize Event Handler
13) Take out the when Texting1.MessageRecieved event handler and add the following code: set the Texting1.PhoneNumber to get number, set the Texting1.Message to ResponseMessageLabel.Text, call Texting1.SendMessageDirect
14) To code for the Text-to-Speech, add an if-then block under the code from above
15) Set 'if' to TextToSpeechBox.Checked
16) Under 'then', add call TextToSpeech1.Speak Message and attach a join block with 3 strings: text string with text - "message from ", get number, get messageText
17) Take out the when EditButton.Click event handler and set the MessageInputForm.Visible to true
18) Take out the when SubmitButton.Click event handler and add an if-then-else block to it
19) Set 'if' to check if the ResponseInput.Text is empty
20) Under 'then', call Notifier1.ShowMessageDialog, attach text strings to the 3 strings, and add the text following text to the strings:
message - "Please put a message in the text box."
title - "No message"
buttonText - "Ok"
21) Under 'else', set ResponseMessageLabel.Text to ResponseInput.Text and call TinyDB1.StoreValue
22) For the 'tag' string attach a text string and type "responseMessage" and set the valueToStore to ResponseInput.Text
23) Under the call TinyDB1, set the MessageInputForm.Visible to false and set the ResponseInput.Text to a blank text string.
24) Take out the when ResetButton.Click event handler
25) Here there will be a double-check, so call Notifier2.ShowChooseDialog and add the following text to the strings:
message - "Are you sure you want to reset the database? You will not be able to reverse the action."
title - "Reset the Database"
button1Text - "Yes"
button2Text - "No"
cancelable - false
26) Take our the when Notifier2.AfterChoosing event handler and add an if-then block to it
27) Under 'if', use the logic block to check if get choice is equal to "Yes"
28) Under 'then', call TinyDB1.ClearAll
29) Finalize the app and make the UI easy to navigate; you may additionally change the colors and width/height settings of the UI components
Since our project is entirely computerized, we used safe websites and trusted softwares only. This was to ensure complete security, so we don't get hacked or catch a virus.
When the edit button it clicked, the horizontal arrangement for custom messages becomes visible.
This block sets the saved message as the response text, so when the user gets a text, that message will be sent. It also sets the horizontal arrangement for custom messages to not visible.
When the user gets an incoming text while the app is running, this block sends the saved response text to that phone number automatically. Also, this block checks to see if the Text to Speech Box is checked. If it is checked, the Text to Speech component is called, and it says which phone number the incoming message is from and what the message said.
This block sets the edited response as the saved response text. If the text box is blank, the user will be notified. After clicking the button, the new response is saved, the label changes to that response, and the horizontal arrangement becomes invisible.
When the reset button is clicked, a notifier double-checks to make sure you actually want to clear the data. If you choose yes, the Database (TinyDB) will clear.
For easy navigation, we designed a simple user interface. It is a minimalist design to allow for a driver to quickly set it up. Using MIT app inventor and companion, we can code this app and allow it to work on a phone. When the user connects to the companion, a pre-set response will be sent as a reply to every incoming message. The user can edit this pre-set response to their liking. Automatically sending responses allow drivers to focus fully on driving. Our main component used was the Texting component. It is the whole basis of our app and allows automated messages to be sent.
This app could prevent accidents and fatalities on the road by allowing drivers to automatically send replies to incoming texts. In current society, many drivers text while driving which could lead to mistakes, sometimes deadly ones. This app will keep a driver off their phone by automatically replying to a text without keeping the sender waiting. As long as a driver has the app running, it will function as needed. Hopefully, this app reduces phone usage while driving in order to lower accidents caused by lack of focus.
Does the app comply with the laws and regulations related to texting while driving in different regions and countries?
Yes, there are regulations in some countries regarding the recording of driving habits. We could restrict usage in those regions If there are rules protecting them, but here are some general examples:
United States: There are no federal laws that specifically regulate the recording of driving habits, but some states have laws that govern the use of dash cameras or other in-car recording devices.
Europe: The European Union has implemented the General Data Protection Regulation (GDPR), which provides guidelines for the collection and use of personal data, including data collected by in-car recording devices.
Australia: There are no specific laws that regulate the recording of driving habits in Australia, but the privacy laws and regulations regarding the use of in-car recording devices may apply.|
Canada: The recording of driving habits is governed by privacy laws and regulations, including the Personal Information Protection and Electronic Documents Act (PIPEDA), which sets out the rules for the collection, use, and disclosure of personal information.
Are there any plans for future updates and improvements to the app?
Yes, here is an example: Integration with vehicle systems: The app can be integrated with the vehicle's onboard computer system to detect when the user is driving and automatically activate the "Do Not Disturb" mode.
How does the app ensure the privacy and security of its users' data?
The app can ask users to grant specific permissions, such as access to the device's GPS or accelerometer, to ensure that the data collected is being used only for the intended purpose.
How does the app detect when a user is driving and prevent them from texting?
GPS tracking: The app can use the GPS system in the user's device to track their location and determine if they are moving at a high speed, which is an indicator that they are driving.
Accelerometer and gyroscope: The app can use the accelerometer and gyroscope in the user's device to detect sudden movements, such as rapid acceleration or braking, which are also indicators that the user is driving.