Oct 27, 2023

An Overview of the DJI SDK v5.3

An Overview of the DJI SDK v5.3

DJI, a leading name in the drone industry, made notable advancements with it’s 5.0 release. By DJI SDK 5.3 it was receiving significant interest by developers with the official sunsetting of updates to V4.  Godfrey Nolan, President of RIIS LLC., at one of the recent drone developer meetups, broke down the changes and addressed several aspects of the release.

What’s Was New in the DJI Android 5.X SDK?

Arguably the most prominent highlight from the 5.3 release is the SDK’s support for consumer drones. This move breaks away from the exclusivity that previously tied the V4 SDK with enterprise drones, which can be extremely cost-prohibitive with a starting price of around $5,000. This means that a broader range of users can now access the V5 SDK, allowing for a myriad of applications across various sectors.

Version 4 will no longer receive updates beyond bug fixes. Version 5 currently supports the following drones:

  • DJI Mini3 Pro

  • DJI Mini3

  • Mavic 3 Enterprise Series

  • M30 Series

  • M300 RTK

  • Matrice 350 RTK

With RIIS’ experience working on more than half a dozen V4 apps we were able to define what the major differences are. For one, Waypoints are more complicated than in V4. Here is an example of the V5 Waypoint structure:

If you had routes before in V4, you will have to update them to this structure. A workaround to make this easier is to first upload them to DJI Pilot and then redownload them in the V5 format.

As of version 5.3, there were fewer widgets in v5 than in v4, but we have not done a recent comparison to see if that has changed for v5.6, the latest release. 

Overall, after sourcing other developer’s feedback, the structure in v5 is more logical and easier to work with. Just be careful of the gotchas noted above.

Getting Started with the SDK

DJI’s approach to creating sample apps is rather impressive. Instead of a basic “Hello World” application, DJI offers a massive sample app. While this app showcases the extensive range of features possible with the SDK, it might not be the most straightforward to run.

When coding the SDK, you’ll be limited to a few core abilities: running a live stream, planning a route, connecting to the drone, and setting up permissions. All of that is covered in the “Hello World” registration app.

Integrating the SDK with Android Applications

Let’s take a look at the example ‘Hello World’ registration app in Android Studio (we ran it on Chipmunk to ensure stability). The first thing to note is the permissions you will need from the OS for the application to run properly. You can see them all listed in the MainActivity.kt file. In our example it is in app/src/main/COM/{{app name}}/importsdkdemo/.

Every time you start an app, the main thing you are going to need to do is invoke startSDKRegistration(). This requires some keys from DJI.

DJI is diligent about making sure anyone who uses an app has the required API keys. You will have to go to developer.dji.com, open up an account, enter your package name, and tell them what type of app you are developing. You will receive an API key as well as an email to activate it. You will then have to add your key to the AndroidManifest.xml and reference it in local properties.Local properties will be ignored through git.ignore.

There are actually three API keys total: the controller, the aircraft, and one for the DJI libraries.If you haven’t grabbed them all yet, head back to the developer portal to do so. Once you have successfully added the three API keys to the manifest.

Okay, let’s head back to MainActivity.kt. The startSDKRegistration() is just doing a callback utilizing this API key and package name to see if DJI has a matching record in their database.It can be useful to add a toast pop-up to validate that the registration went through.

At this point, the demo we’ve created isn’t capable of much, but it does help us prove we can import the different DJI libraries. If everything has gone correctly, if you check in build.gradle, you can see all the libraries for DJI.

Taking a Look at the Sample App

Let’s move onto something more complex—a lot more complex.The sample app boasts an impressive array of features. It includes a map, connection info, GPS, battery info, etc. However, it can be a little difficult to set up. Let’s take a look under the hood.

After importing it into Android Studio, you have to open it under the android-sdk-v5-as and everything should fall into place.

Under sample-module-aircraft/java/models/ you should find a decent-sized library of features and widgets including waypoints, map, simulator, payload, etc. In the image above you can see some sample code from the flight recorder widget.

Within sample-app-aircraft/java/djisamplev5aircraft/ you will find aircraft testing tools. This exposes information on how you could do virtual controls and in turn allows for more easily achievable programmatic navigation.

Peeling back the Sample App Layers

This link is your liferaft:


In it, William Wong has laid out how the official sample app is structured and the steps you will need to get started. Once you get past the setup, you will want to follow on to Chapter 3: Integrate the SDK into your project. This will serve you better than the official DJI guide.

You will learn how to set up the application context to pull in the DJI library and have it globally spread across your app; how to access all the different ‘.so’ libraries; what the permissions need to be; what you need to add to the AndroidManifest.xml ; what intent filters you need to add; how to compose the MSDK init method; and how to import the UXSDK library. Follow the steps, and you will have successfully integrated the SDK into your project.

Using the UXSDK

Let’s take a closer look at the UXSDK. In Mobile-SDK-Android-V5/SampleCode-V5/andorid-sdk-v5/uxsdk/src/main/res/layout/uxsdk_activity_default_layout.xml you will be able to see all the widgets and their properties.

For those diving into Android development, the UXSDK is indispensable. Previously not open source, the SDK now provides access to a plethora of ready-to-use widgets that make development significantly more streamlined. These widgets cover everything from altitude to battery status, flight controls, and much more. Developers can incorporate these widgets into their applications without having to code them from scratch.

For those curious about which widgets are available, the sample application provides a comprehensive list on its first page.

You can click on WIDGET LIST here to see the list of available widgets.

Testing Tools

If you click on TESTING TOOLS, you will find a list that is very similar to the Collection of MSDK V5 Documents. Let’s click on Virtual Stick and see what we get.

Here you will see the Virtual Stick code in action and how it can be augmented. That’s nice, but what if you want to see the code and modify it to make your own? Head over to Mobile-SDK-Android-V5/SampleCode-V5/android-sdk-v5-sample/module-aircraft/src/main/java/dji/sampleV5/moduleaircraft/pages/VirtualStickFragment.kt.

There are corresponding fragments within the pages folder for each of the MSDK features. 

Basic Tips

Unwinding the DJI V5 SDK can be a little tricky, but use these basic tips to keep yourself on the right path:

  • Stick with an earlier version of Android Studio

  • Estimate more time for creating waypoint missions and custom widgets

  • Use William Wong’s forum page

  • For Enterprise drones, you need to force close the Pilot 2 app

  • SDK v4 is no longer being updated, bug fixes only

  • Don’t buy the RC with the screen