I've been lucky enough to never be a victim of street crime, but I have read and seen too many articles and videos to completely rule it out as a possibility. You can do some things to prevent it, but if your life suddenly turns into a scene from Friday the 13th, you'll want to be prepared with some sort of way to let others know you need help. This is where Shake2Safety comes in, a free Android app from Phontonapps.
With Shake2Safety, you can set your phone to send a message to or call a specific contact whenever you shake your device. This app isn't ideal to have on at all times since you can accidentally activate it while walking, but it can be activated quickly enough that if you find yourself in a dark alley or abandoned insane asylum, you can rest a little easier.
Shake2Safety is available for free from the Google Play Store and does not require root-level access to run.
The first time you open the app, you will need to select who you'd like to set as your emergency contact. Once you make a selection, you'll need to choose whether you want a call, message, or both sent to them when you shake your device.
If you decide to to set your device to send a message, it will send a distress message along with a link to your current location.
Before the service is ready to run in the background, you will need to set your sensitivity level. The scale goes from 5 to 100, with 100 being the least sensitive to shakes. Keep in mind that this can be activated while your phone is locked, so set it to a lower sensitivity if you plan on holding your phone in your hand while the service is running.
The app will display a persistent notification in your notification drawer the entire time it is running, but you can disable it by selecting "Hide Notification" from the action bar's overflow menu, then unchecking the "Show notifications" option. I would suggest you keep the notification on since it will make it easier to disable the service and prevent accidental messages and phone calls.
Remember that this should only be active when you feel threatened by your surroundings because you wouldn't want to give your mother a panic attack like I did when testing this out.