🛡️ Campus Shield A live GPS emergency safety app for NJIT students built with SwiftUI.

Campus Shield connects students directly to NJIT Public Safety with one tap — sharing real-time GPS coordinates, enabling emergency chat with media sharing, and providing multiple discreet SOS triggers including volume buttons, shake detection, back tap, a lock screen widget, and a Siri shortcut.

Features 🚨 Emergency Dial One-tap connect to NJIT Public Safety (973-596-3111) Auto-dials on emergency activation Call 911 and Text 911 buttons available in the dashboard Automated 911 text includes live GPS coordinates, accuracy, elevation, and direct Apple Maps + Google Maps links 📍 Live GPS Tracking Real-time latitude, longitude, altitude, speed, and accuracy Barometric altimeter (relative) with GPS absolute fallback Sea level elevation display (WGS84) GPS accuracy tier system: Excellent / Good / Fair / Signal Lost Location silently starts on app launch so coordinates are ready immediately 💬 Emergency Chat Real-time message interface with NJIT Public Safety Quick reply buttons for common emergency phrases Photo and video sharing via camera capture or photo library Full-screen photo preview iCloud video support via PHImageManager 🆘 SOS Triggers Multiple ways to activate the emergency line:

Trigger Works When Spam volume button (3×) + shake (3×) within 3 seconds App is open Double tap back of phone App is open Lock screen widget tap Anywhere — no unlock needed Back Tap → Shortcuts deep link Anywhere (one-time setup) 🔒 Lock Screen & Home Screen Widget Three widget sizes — lock screen circular, lock screen rectangular, and home screen small tile — all one tap away from the emergency dial.

Screenshots Add screenshots here

Requirements iOS 16.0+ Xcode 15+ Real iPhone required (GPS, camera, and accelerometer do not work in the simulator) Setup

  1. Clone the repo git clone https://github.com/yourusername/campus-shield.git cd campus-shield
  2. Open in Xcode open CampusShield.xcodeproj
  3. Add Info.plist privacy keys Add the following keys to your Info.plist:

Key Purpose NSCameraUsageDescription Camera access for photo/video capture NSMicrophoneUsageDescription Microphone access for video recording NSPhotoLibraryUsageDescription Photo library read access NSPhotoLibraryAddUsageDescription Full photo library access NSLocationWhenInUseUsageDescription GPS tracking NSLocationAlwaysAndWhenInUseUsageDescription Background GPS tracking NSMotionUsageDescription Shake and back tap SOS detection

  1. Enable capabilities In Xcode → Target → Signing & Capabilities:

Add Background Modes → check Location updates

  1. Register URL scheme In Xcode → Target → Info tab → URL Types → add:

Identifier: com.campusshield.app URL Schemes: campusshield

  1. Add the Widget Extension File → New → Target → Widget Extension Name: CampusShieldWidget Uncheck "Include Live Activity" and "Include Configuration App Intent" Replace the generated Swift file contents with NJITSafetyWidget.swift
  2. Build and run to a real device Select your iPhone as the build target and hit Run.

Back Tap Setup (Background SOS) To enable double-tapping the back of your phone as an SOS trigger from anywhere on the device:

Open the Shortcuts app Tap + → Add Action → search Open URLs → enter campusshield://sos Name the shortcut Campus Shield SOS Go to Settings → Accessibility → Touch → Back Tap → Double Tap Select Campus Shield SOS A step-by-step guide is also built into the app on the start screen.

Architecture CampusShield/ ├── Models │ ├── ChatMessage # Text + optional media attachment │ ├── GPSReading # Location data with computed properties │ └── MediaAttachment # Photo or video enum │ ├── Managers │ ├── LocationManager # CLLocationManager + CMAltimeter │ └── SOSTriggerManager # Volume + shake + back tap detection │ ├── Views │ ├── ContentView # Root — routes start vs emergency │ ├── StartScreenView # Launch screen with SOS hints │ ├── EmergencyDashboardView # Active emergency UI │ └── BackTapSetupView # Step-by-step Back Tap guide │ ├── Components │ ├── ChatBubbleView # Text and media bubbles │ ├── CoordCell # GPS coordinate display cell │ ├── StatusPill # Voice / GPS status indicators │ └── SetupStep # Numbered step card │ ├── Pickers │ ├── MediaPicker # PHPickerViewController wrapper │ └── CameraPicker # UIImagePickerController wrapper │ └── Widget └── NJITSafetyWidget # Lock screen + home screen widgets Emergency Contacts Contact Number NJIT Public Safety 973-596-3111 Emergency 911 Roadmap Firebase backend for real-time media delivery to dispatch Apple Watch companion app for gesture-based background SOS Push notifications from dispatch to user Incident history log Multi-campus support Contributing Pull requests are welcome. For major changes please open an issue first to discuss what you'd like to change.

License MIT

Built for NJIT student safety. Not an official NJIT product.

Built With

Share this project:

Updates