1. Register with DJI:
https://developer.dji.com/ and create an app in the User Center page. You will see an App Key that you need to add to the manifest editor.
The bundle identifier must match your app package name.
2. Add this code to the manifest editor:
B4X:
AddReplacement($DJI_KEY$, XXXXXXXXX)
CreateResourceFromFile(Macro, DJI.DJI)
Replace XXXXXXXXXX with your App key.
3. Add to the main activity code:
B4X:
#BridgeLogger: true
#MultiDex: true
#AdditionalJar: dji-sdk-provided-4.16, ReferenceOnly
#AdditionalJar: kotlin-stdlib-1.5.10
4. You might need to install a few components with B4A Sdk Manager.
5 Initialize the SDK when the application starts. The RegisteredResult event will be raised. If successful then call sdk.StartConnectionToProduct to start a connection.
6. The ProductConnected event will be raised. If AircraftData is not Null then you are good to go and can initialize the DJIAircraft object and the other features (see how it is done in the example).
7 Most of the operations are asynchronous. They are built to work with the Wait For keyword.
8. Expect disconnections and other errors.
9.
New: See the Activity_Resume code in the example. It is needed to handle reconnections.