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.