Abstract:
With the rapid growth of the low-altitude economy, the large-scale deployment of unmanned aerial vehicles (UAVs) has imposed increasingly stringent demands on airspace safety and regulatory compliance. To address the need for real-time awareness of in-air UAV operations and ensure safe, rule-compliant flights, this paper proposes a lightweight, portable geofencing monitoring solution implemented on HarmonyOS-based mobile devices. The system architecture comprises four core modules: data communication, UAV management, geofence management, and alert management. It adopts a hybrid development approach using ArkTS and C++, with cross-language interoperability enabled through the HarmonyOS Native API (NAPI). By integrating 5G connectivity and the MQTT protocol, the system achieves low-latency transmission and real-time local processing of UAV positional data.To handle complex geofencing scenarios involving multiple no-fly zones, the algorithm first constructs a pseudo-simple polygon by bridging outer boundaries and inner holes. This is followed by ear-clipping triangulation as a preprocessing step. A graph-based spatial search algorithm leveraging Breadth-First Search (BFS) over the resulting triangular mesh is then employed for boundary violation detection, enhanced with a starting-point caching mechanism to improve efficiency. Experimental results demonstrate that the proposed method accurately handles both simple and complex polygonal geofences—including those with multiple holes—with a boundary violation detection accuracy approaching 100%. Moreover, end-to-end communication latency is consistently maintained below 1.3 seconds, confirming the system's suitability for regulatory applications involving small- to medium-sized low-altitude UAVs and highlighting its strong practical value.