Unagi - A context aware emergency manager

HackNC 2016


In light of the current scenario in Raleigh (and elsewhere), we hear about unfortunate incidents like mugging, robbery, sexual assault, people stranded in Hurricane, etc. In such cases, it could be of immense help if some of the friends or loved ones can get notified about the victim’s situation in a timely manner or can get a continuous update about the victim’s environment (context) and further, 911 could be called in a timely manner, if needed. But the victim is not always in the right state of affairs to inform their loved ones about their situation themselves.


The app is context-aware as it monitors and detect a mobile user’s environment using sensors in the phone such as GPS, accelerometer, pressure, time. For this purpose we have used the Google Awareness API. Using this API, the app can fetch several kinds of contexts like time, location, nearby places, activity (walking, driving, etc.) and weather. Further, we use PlaceILive API to detect the safety of a neighborhood the user is in. Also, we have integrated a speech recognition engine using Pocketsphinx API which continuously listens for an emergency word (like "help me"). Based on the input from all the APIs, the app can make predictions about whether a user is in an emergency or potentially risky situation. The primary goal of the app would be to send pulse updates to an emergency contact about the user’s environment if some set of conditions (based on the contexts) are met.
The app defines Fences, as used in the Awareness API, which are a combination of inputs from different sensors in the phone. We can register multiple Fences in the device, for instance:

  1. If the user is walking/ running/ driving after 12 AM in a neighborhood which is unsafe.
  2. If the user is driving in bad weather conditions like heavy ice or snow.
  3. In the emergency situation if person is being assaulted or mugged and he/she is shouting for "help"

These Fences are monitored, at regular intervals, by a daemon process in the user's device. If any of the fence is triggered (a set of conditions are met), the app starts sending pulse SMSs to an emergency contact.

API used

  1. Google awareness API
  2. Pocketsphinx-android
  3. PlaceILive API

How we built it

The app was built in 4 stages:

  1. Integrating the Google Awareness API and creating "fences" for emergency situations.
  2. Building the speech recognition engine using Pocketsphinx (a library by CMU).
  3. Making REST calls to PlaceILove endpoint to get safety predictions about a particular place.
  4. Using the pre-set emergency contact to send information like location, nearby places, weather conditions, etc.


  1. As the awareness API uses multiple sensors, synchronizing the result from their callbacks was tricky to handle.
  2. The most challenging task was to create the speech recognition engine which can listen to a user 24*7 and precisly predict the emergency word. This aspect of the app still has a lot of scope for improvement.

What it does

  1. The app uses the feedback from all the mobile sensors like GPS, accelerometer, pressure, etc. to predict the environment of a user.
  2. The app also continuously listens to the user for an emergency code-word ("help me").
  3. Using the sensor data as input to Google Awareness API, it predicts the nearby places. Using this as input to PlaceILove API, it predicts the safety level of the place.
  4. If the app predicts a vulnerable situation based on all the aforementioned conditions, it starts sending pulse notifications to an emergency contact.

Future work

  1. The speech recognition engine has a lot of scope for improvement.
  2. We can also integrate run-time adaption in the app i.e. if the user does not want to send alert notifications for some of the contexts (like if it is common for the user to walk during night) then they may chose to deselect such notifications. This would evolve into the app having different behavior for different users.
  3. While driving we can detect the speed limit in a particular area and use that feedback to improve our predictions.

Domain.com - Best Domain Name Registered with Domain.com

We registered the domain unagi-tech.com thanks to the generous people at Domain.com

Built with :heart: at HackNC by Unagi-Tech

Built With

+ 27 more
Share this project: