How to Reduce Mobile App Crash Rates in Security Workforce Management Software
A security guard's mobile app is not a consumer product that users open for a few minutes at a time. It runs continuously through 8 to 12 hour shifts, tracking location in the background, capturing incident photos, and syncing data to a central server. This usage pattern is brutal on mobile devices, and it exposes every weakness in the app's architecture. The result, in many security workforce platforms, is crash rates that far exceed industry benchmarks.
For engineering and IT leaders at security companies, high crash rates are not just a technical nuisance. They erode guard trust in the platform, create gaps in patrol data, and generate support tickets that consume operations staff. In our work with major security workforce platforms, including our engagement with Trackforce Valiant, we have seen firsthand how targeted architectural changes can dramatically reduce crash rates across device fleets numbering in the tens of thousands.
The Patterns That Cause Crashes
Security apps crash for predictable reasons. Understanding these patterns is the first step toward fixing them.
Long-Running Background Services
Android's background execution limits, introduced in Android 8.0 and tightened in every subsequent release, are the single largest source of crashes in security apps. Many legacy codebases rely on background services to maintain persistent GPS tracking. When the OS kills these services to reclaim resources, the app crashes or enters an undefined state.
The fix is to migrate from plain background services to foreground services with a persistent notification, combined with WorkManager for periodic tasks. Foreground services are explicitly permitted by the OS and will not be killed under normal conditions. The persistent notification also serves a UX purpose: it reassures the guard that tracking is active.
On iOS, the equivalent issue arises from improper use of background modes. Apps that claim continuous background location but do not actually need second-by-second updates will be terminated by the system. Using significant location change monitoring or deferred location updates, where appropriate, keeps the app within Apple's guidelines and prevents termination.
Memory Leaks from GPS Listeners
A location listener that is registered but never unregistered is a textbook memory leak. In security apps, this manifests as a slow climb in memory usage over the course of a shift. After six or eight hours, the app exceeds the device's memory budget and the OS kills it.
The root cause is usually a location callback that holds a reference to an Activity or Fragment context. When the UI component is destroyed and recreated, as happens during a configuration change like a screen rotation, the old callback persists with a stale reference. Over time, these stale references accumulate.
The solution is to bind location listeners to lifecycle-aware components. On Android, using LifecycleObserver or scoping location updates to a ViewModel ensures that listeners are cleaned up automatically. On iOS, invalidating CLLocationManager delegates in deinit serves the same purpose.
Camera and Media Handling on Low-End Devices
Security companies typically provision budget Android devices for their guard workforce. These devices often have 2 to 3 GB of RAM and modest processors. When a guard captures an incident photo, the camera intent or in-app camera can consume a large amount of memory. If the app does not handle this carefully, the OS will kill background processes, including the app's own processes, to free memory for the camera.
Practical mitigations include: compressing images immediately after capture rather than storing full-resolution bitmaps in memory, using FileProvider to pass image URIs between the camera and the app instead of passing raw byte arrays, and implementing onSaveInstanceState to preserve the app's state in case the process is killed while the camera is active.
Monitoring and Triage Workflow
Reducing crash rates requires more than fixing individual bugs. It requires a systematic monitoring and triage workflow that continuously identifies and prioritizes issues.
Crash Reporting Infrastructure
Firebase Crashlytics or Sentry should be integrated into every build, including internal QA builds and production releases. The key is to go beyond default configuration:
- Attach custom keys to every crash report: the current shift ID, the guard's assigned site, device model, OS version, available RAM at the time of crash, and battery level.
- Log non-fatal exceptions aggressively. An
OutOfMemoryErrorthat is caught but not reported is a missed signal. Similarly,SecurityExceptionfrom missing permissions andSQLiteExceptionfrom database corruption should all be logged as non-fatal events. - Set up alerts for crash rate thresholds. A healthy security app should maintain a crash-free session rate above 99.5%. If the rate drops below 99% on any device segment, that should trigger an investigation.
Segmenting by Device and OS
In our experience working with large security workforces, crash rates vary enormously across device segments. A fleet-wide crash rate of 98.5% might mask the fact that Samsung Galaxy A-series devices on Android 10 are crashing at a 95% crash-free rate while Google Pixel devices on Android 14 are at 99.8%. Segmenting crash data by device manufacturer, model, OS version, and RAM tier is essential for effective triage.
This segmentation also informs procurement decisions. If a particular device model consistently underperforms, IT leadership needs that data to adjust their hardware standards.
Weekly Triage Cadence
The most effective teams we have worked with follow a weekly triage cadence:
- Pull the top 10 crash clusters from Crashlytics or Sentry, sorted by number of affected users.
- For each cluster, identify the root cause category: background execution, memory, permissions, database, or network.
- Assign severity based on impact. A crash that occurs during incident report submission is higher priority than one triggered by an obscure settings screen.
- Fix the top three issues each sprint. This steady cadence produces compounding improvements over months.
Defensive Coding Patterns
Beyond fixing specific bugs, adopting defensive coding patterns prevents entire categories of crashes from occurring.
Null Safety and Type Safety
If the codebase is in Java, migrating critical paths to Kotlin provides null safety at the compiler level. This eliminates NullPointerException, which is consistently among the top crash causes in Android apps. For iOS codebases, using Swift's optionals with guard statements rather than force unwrapping achieves the same protection.
Graceful Degradation
When a GPS fix is unavailable, the app should not crash or display an error dialog. It should degrade gracefully: show the last known location with a visual indicator of staleness, and continue operating. When the database is corrupted, the app should rebuild it from cached data rather than crashing on the next read. When a network call fails, it should queue the request for retry. Every failure mode should have a defined recovery path.
ANR Prevention
Application Not Responding events are not crashes in the traditional sense, but they are equally destructive to user experience. In security apps, ANRs most commonly occur when database operations or network calls are performed on the main thread. Strict adherence to moving all I/O off the main thread, using coroutines on Android or async/await on iOS, eliminates this category entirely.
Measuring Progress
Track crash-free user rate and crash-free session rate as top-level engineering KPIs. Report them weekly to engineering leadership and monthly to the broader organization. When these numbers improve, it translates directly to fewer support tickets, more complete patrol data, and higher guard satisfaction scores.
In the security industry, where apps run for entire shifts on devices that take a beating, achieving and maintaining a 99.5%+ crash-free rate is both challenging and essential. It requires disciplined architecture, proactive monitoring, and a commitment to fixing the unglamorous bugs that affect real devices in the field.
DEVSFLOW Guarding specializes in building and stabilizing mobile apps for the security workforce management industry. If crash rates and app instability are affecting your guard operations, visit guarding.devsflow.ca to learn how we can help.