Fly Zone Unlocking Tutorial
Fly Zone Unlocking Tutorial
1. Overview
The fly zone unlocking feature allows developers to monitor changes in flight restriction zones near the aircraft. Through fly zone unlocking, you can obtain information about restricted areas within a specific kilometer range around the aircraft and unlock specified areas. After unlocking, there will be no more fly zone warnings and takeoff restrictions will be removed.
2. Fly Zone Categories
MSDK categorizes fly zones in the FlyZoneCategory enumeration:
Fly Zone Type | Description |
---|---|
WARNING | Warning Zone |
ENHANCED_WARNING | Enhanced Warning Zone |
AUTHORIZATION | Authorization Zone |
RESTRICTED | Restricted Zone |
HEIGHT_RESTRICTED | Height Restricted Zone |
Note:
- If the aircraft encounters a restricted zone during flight or exceeds the height limit, it will hover at the boundary and cannot be controlled to move further into the restricted area.
3. Obtaining Fly Zone Information
Use getFlyZonesInSurroundingArea() to get fly zones within a 50-kilometer radius of the center position, including temporary restricted areas and geosensing zones;
Use getDroneFlyZoneCountryCode() to get the current aircraft's country code;
Use getHotZoneCountryCode() to get the country code for hotspot areas.
Note:
- If too many fly zones are retrieved, rendering them on the map may cause performance issues. It's recommended to implement optimization for display.
4. Fly Zone Unlocking
Here are the steps for unlocking fly zones.
Apply for authorization zone through after-sales support.
Use downloadAuthFlyZoneFromServer() to obtain authorization zones from the server using the aircraft's serial number.
Use pushAuthFlyZoneToAircraft() to import the authorization matching the current aircraft's SN to the flight controller. The authorization becomes effective upon successful import.
Use getAuthFlyZone() to retrieve locally stored unlocking information.
Use deleteAuthFlyZoneFromAircraft() to remove authorization zone information from the aircraft.
5. Interface Call Flow
The diagram below shows an example of the fly zone unlocking interface call flow. Not every step needs to be followed - please call according to your actual needs. For detailed usage, please refer to the IFlyZoneManager class in the MSDK API documentation.
6. API Call Instructions
6.1 Obtain No-Fly Zones within a 100km Radius of the Drone
The example code is as follows:
FlyZoneManager.get().getFlyZonesInSurroundingArea(location, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>?>{
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
location:position informationLocationCoordinate2D
6.2 Retrieve aircraft authorization area information from the server
The example code is as follows:
FlyZoneManager.get().downloadAuthFlyZoneFromServer(
aircraftSN,
location,
object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneAuthInformation>?>{
override fun onSuccess(t: List<FlyZoneAuthInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
aircraftSN:Aircraft SN number
location:Center positionLocationCoordinate2D
6.3 Upload authorization zone files to the aircraft
The example code is as follows:
FlyZoneManager.get().pushAuthFlyZoneToAircraft(device, object: CommonCallbacks.UpLoadFileCallbackWithProgress<Int>{
override fun onStartUploading() {
//start uploading
}
override fun onProgressUpdate(progress: Int) {
// progress info
}
override fun onSuccess() {
// success
}
override fun onFailure(error: IAutelCode) {
//failure
}
})
Parameter description:
device:Drone equipment
Attention: The SN of the authorization area information must match the aircraft SN, otherwise the upload will fail. Once the upload is successful, the authorization area will take effect.
6.4 Obtain authorization area information
The example code is as follows:
FlyZoneManager.get().getAuthFlyZone(device.getDroneSn()!!, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneAuthInformation>?>{
override fun onSuccess(t: List<FlyZoneAuthInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
// faulure
}
})
6.5 Import authorization area file
The example code is as follows:
FlyZoneManager.get().importFlySafeDynamicDatabaseToMSDK(filePath, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>> {
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
filePath:File Path
Attention: Currently, only importing EU geographical perception data is supported. Geographical perception data can be accessed from the official website of the European Union Aviation Safety Agency website Download.
6.6 Importing geographic perception data into aircraft, currently only supports EU data
The example code is as follows:
FlyZoneManager.get().pushFlySafeDynamicDatabaseToAircraft(object: CommonCallbacks.UpLoadFileCallbackWithProgress<Int>{
override fun onStartUploading() {
// start uploading
}
override fun onSuccess() {
// success
}
override fun onFailure(error: IAutelCode) {
// failure
}
override fun onProgressUpdate(progress: Int) {
// progress info
}
})
6.7 Obtain the country code for the flight zone of the aircraft
The example code is as follows:
FlyZoneManager.get().getAircraftFlyZoneCountryCode(aircraftSN, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyableZoneInfo>> {
override fun onSuccess(t: List<FlyableZoneInfo>?) {
//success
}
override fun onFailure(error: IAutelCode,msg: String?) {
//failure
}
})
Parameter description:
aircraftSN:Aircraft SN
7. Interface Details and Sample Code
For interface details, please refer to IFlyZoneManager
For implementation examples, please refer to FlyZoneFragment in the Sample project