Skip to main content

AUTEL Android Mobile SDK Development Workflow

1. Overview

The AUTEL Mobile SDK is a software development kit designed to give developers access to the rich functionalities of AUTEL's aircraft products. The SDK simplifies the application development process by encapsulating lower-layer functionalities into simple and easy-to-use APIs. By accessing the SDK, you can obtain external APIs exposed by the aircraft products to get the aircraft album, battery, camera, image transmission, and mission information.

2. Preparations

2.1. Android Development Environment

Android Studio (Currently Eclipse is not supported)

2.2. Register as a Developer

Register for a Developer account on Autel Developer Platform, create an application, and apply for a unique app key for the application. This app key will be used for initializing the SDK. Each application has only one app key.

2.3. Example

You can quickly learn the APIs provided by the SDK by viewing the following SDK code example:

Android project code example

3. Access the SDK

3.1. Add Dependency

Click "Downloads" on the Developer Platform. The latest Mobile SDK for Android and iOS will be displayed.

NOTE: In the preceding example, the downloaded SDK is saved in a new folder named release. You can change the local path of the SDK dependency as required.

3.2. Initialize the SDK

Define TestApplication inherited from Application and then initialize the SDK in TestApplication:

 String appKey = "<SDK license should be input>";
AutelSdkConfig config = new AutelSdkConfig.AutelSdkConfigBuilder()
.setAppKey(appKey)
.setPostOnUi(true)
.create();
Autel.init(this, config, new CallbackWithNoParam() {
@Override
public void onSuccess() {
Log.v(TAG, "checkAppKeyValidate onSuccess");
}

@Override
public void onFailure(AutelError error) {
Log.v(TAG, "checkAppKeyValidate " + error.getDescription());
}
});

NOTE: When the application stops using the AUTEL SDK service (the application exits generally), you can call Autel.destroy() to stop calling relevant SDK resources.

3.3. Monitor USB Events on Your Photo

Connect the remote controller to your phone via USB. The phone needs to receive broadcast messages about USB events.

The custom broadcast receiver is inherited from BroadcastReceiver. Register the custom broadcast receiver in the manifest file:

public class UsbBroadCastReceiver extends BroadcastReceiver {
final String TAG = getClass().getSimpleName();

@Override
public void onReceive(Context context, Intent intent) {
/**
* Monitor broadcast intents sent from the device connected via USB
*/

}
}

Add and register a broadcast receiver in the AndroidManifest.xml file:

 <receiver android:name=".UsbBroadCastReceiver">
<intent-filter>
<action android:name=
"com.autel.sdk.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name=
"android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</receiver>

NOTE: When registering a broadcast receiver, you must use a transparent Activity for receiving broadcast intents.

3.4. SDK API Overview

The Mobile SDK provides function services of the following modules: Album, Battery, Camera, Image Transmission, FlyController, Gimbal, Mission, RemoteController, and Codec

You can use the Autel.setProductConnectListener(ProductConnectListener listener) method to listen for APIs exposed by the aircraft, obtain the BaseProduct API, and further obtain the APIs of relevant modules. The following shows how to obtain the APIs of each module. For details about API usage of each module, see the corresponding API documentation:

Autel.setProductConnectListener(
new ProductConnectListener() {
@Override
public void productConnected(
BaseProduct product) {
//.....
/**
* the obtained product is the collection of module APIs provided externally by the aircraft
*/
//....

}

Obtain the APIs provided externally by the aircraft and then further obtain the APIs of each module, for example:

....
BaseProduct product;
...
switch (product.getType()) {
case EVO_2:
...
//Album
AutelAlbum autelAlbum = product.getAlbum();
//DSP
EvoDsp dsp = ((Evo2Aircraft) product).getDsp();
//Camera
AutelCameraManager autelCameraManager
= product.getCameraManager();
//Mission
MissionManager missionManager = product.getMissionManager();
//RemoteController
AutelRemoteController remoteController
=product.getRemoteController();
//FlyController
Evo2FlyController flyController
=((Evo2Aircraft) product).getFlyController();
//Gimbal
EvoGimbal evoGimbal = ((Evo2Aircraft)product).getGimbal();
//Battery
EvoBattery battery = ((Evo2Aircraft) product).getBattery();
//Codec
AutelCodec codec = product.getCodec();
....
break;
}

4. End

Obtain BaseProduct through a callback and then obtain the APIs of each aircraft module through BaseProduct. For details, see API documentation of each module.