The official sample is saved on the Github space and gets updated periodically. It consists of 3 projects, android-sdk-v5-as, android-sdk-v5-sample, and android-sdk-v5-uxsdk.
- Project android-sdk-v5-as defines the sample project properties and settings for the Android Studio.
- Project android-sdk-v5-sample defines the function of this sample project.
- Project android-sdk-v5-uxsdk defines an UI framework.
How to use the official sample:
- Clone the official sample from Github to the local directory.
- Open the Android Studio, and click Open an Existing Project.
- Click Mobile-SDK-Android-V5/SampleCode-V5/android-sdk-v5-as to import the sample project.
- Since the compiled app is from sample-app-aircraft module, you need to go to build.gradle(Module: android-sdk-v5-as.sample-app-aircraft) file to check the applicationId string. In our sample project, it is applicationId=com.dji.sampleV5.aircraft.
- Go to the developer website to apply for a new app key. Please be noted that the Package Name must be identical to the applicationId. In our sample project, the applicationId=com.dji.sampleV5.aircraft.
- The applied app key consists of a series of English alphabet and numbers. You need to write it into the AIRCRAFT_API_KEY in gradle.properties (Project Properties) file.
- After installing the compiled APK, you can run the official sample, your mobile device requires internet access for the first attempt.
After successfully importing the sample project, you can find 4 modules in total. They are sample-app-aircraft, sample-module-aircraft, sample-module-common, and uxsdk.
- Module sample-app-aircraft contains the initialization of aircraft sample, SDK installation, etc.
- Module sample-module-aircraft contains all functions which are related to the aircraft products.
- Module sample-module-common contains all common functions which are related to both the aircraft product and handheld products.
- Module uxsdk contains the definition of the UI framework.
【After 5.3】
Version 5.3 removes the Handheld and Global modules, leaving only the aircraft module.
【After 5.8】
The structure of the sample code has changed in version 5.8. The sample code becomes only two modules: android-sdk-v5-sample and android-sdk-v5-uxsdk.
- android-sdk-v5-sample contains all the sample code for the aircraft functionality.
- android-sdk-v5-uxsdk contains UI controls as well as sample pages.
Comments
1 comment
Hey William, for step 7, do you have to modify something to make it build? When I try to make a run config for android app, it shows as "Module not specified", with no options for modules. Using newest android studio.
Please sign in to leave a comment.