public class

DJISDKManager

extends Object
java.lang.Object
   ↳ dji.sdk.sdkmanager.DJISDKManager

Class Overview

This class contains methods for you to the register app, start or stop connection with the product. After registration, the connected product can be accessed through DJISDKManager. The components of the product can then be controlled.

Summary

Nested Classes
interface DJISDKManager.DJISDKManagerCallback Callback interface for SDK manager. 
Fields
public static final String USB_ACCESSORY_ATTACHED
public DJISDKManager.DJISDKManagerCallback sdkManagerCallback
Public Methods
void addSubscription(Subscription subscription)
String archiveLogs(DJICommonCallbacks.DJICompletionCallback callback)
The DJI Mobile SDK collects logs that are related to flight.
void closeAoaConnection()
This method is for developer to close the aoa connection directly.
void destroy()
Releases the resources held by the DJISDKManager.
void enterDebugModeWithDebugIP(String debugIP)
Enter debug mode with debug IP.
DJISDKCache getCache()
Context getContext()
DJIBluetoothProductConnector getDJIBluetoothProductConnector()
DJIBaseProduct getDJIProduct()
Returns the available DJIBaseProduct object.
DJIFlyZoneManager getFlyZoneManager()
synchronized static DJISDKManager getInstance()
String getSDKVersion()
Gets the DJI Mobile SDK version.
boolean hasSDKRegistered()
true if SDK has already registered.
void initSDKManager(Context context, DJISDKManager.DJISDKManagerCallback callback)
Initiates the SDK.
void registerApp()
The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key.
void setCallbackRunInUIThread(boolean enable)
Determines whether the callback should be invoked in UIThread or BackgroundThread.
void setDisableCountryCodeCheck()
Some products (Mavic Pro, Inspire 2, Phantom 4 Pro) can use 5 GHz wireless spectrum that is not permissable in some countries.
void setSupportOnlyForBluetoothDevice(boolean isBluetoothDevice)
Change the flag if we are only connect bluetooth device.
boolean startConnectionToProduct()
Starts a connection to the DJI product.
void stopConnectionToProduct()
Disconnects the existing connection to the DJI product.
void uploadArchivedLogs(DJICommonCallbacks.DJICompletionCallback callback)
Upload the archive to DJI.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final String USB_ACCESSORY_ATTACHED

public DJISDKManager.DJISDKManagerCallback sdkManagerCallback

Public Methods

public void addSubscription (Subscription subscription)

public String archiveLogs (DJICommonCallbacks.DJICompletionCallback callback)

The DJI Mobile SDK collects logs that are related to flight. These logs can be used to help diagnose the cause of a product's flight failure at the SDK and mobile application layer. They are predominantly used by a DJI service facility, who will combine them with the product's flight logs (stored on the product) to better understand the root cause of a crash and determine whether the incident is covered under warranty. They can also be used by developers to debug their application. SDK Logs record commands from the application to the SDK, and information from the SDK to the application that are related to flight. Logs are cached to the mobile device, and will overwrite themselves to limit storage footprint. `archiveLogs` will move the logs to an archive folder. Logs in the archive, will only be overwritten by newer archives that go beyond the storage limit and not normal log generation. The storage limit for normal log generation is 400 MB (about 500 minutes of flight). The storage limit for the archive is an additional 400 MB. The logs have an encrypted and unencrypted portion. The unencrypted portion can be used by developers to see all commands and information sent to and received from the SDK by the mobile application that are related to flight. The encrypted portion can only be used by a DJI service facility as it includes property hardware protocols and are used to tie the SDK logs and product flight logs together. Logs can be transferred to the DJI service facility either by manually downloading from the mobile device using iTunes, or the application can send archived logs to a DJI endpoint using `uploadArchive`. Developers should be careful to upload logs directly when the user is on a cellular connection as the archive can be up to 400 MB. returns: path of archived logs, nil if a problem occured.

public void closeAoaConnection ()

This method is for developer to close the aoa connection directly. It should not be invoke in normal logic. When developer use AS or Eclipse to build and run app, they will kill the old app first, the kill is not disconnect the aoa link. It will cause the new app can't connect aoa, need to plug in the usb line again. The developer should config AS and Eclipse, make it invoke this method before complie app, so that can close the aoa link first.

public void destroy ()

Releases the resources held by the DJISDKManager. Deallocate memory in the reversed order of #initParams()

public void enterDebugModeWithDebugIP (String debugIP)

Enter debug mode with debug IP.

Parameters
debugIP Debug ID from the DJI Bridge App. Attention!The method should be invoked before initSDKManager()

public DJISDKCache getCache ()

public Context getContext ()

public DJIBluetoothProductConnector getDJIBluetoothProductConnector ()

public DJIBaseProduct getDJIProduct ()

Returns the available DJIBaseProduct object. Returns null if no product is available.

public DJIFlyZoneManager getFlyZoneManager ()

public static synchronized DJISDKManager getInstance ()

public String getSDKVersion ()

Gets the DJI Mobile SDK version.

Returns
  • SDK version as a string.

public boolean hasSDKRegistered ()

true if SDK has already registered.

Returns
  • true if SDK has already registered.

public void initSDKManager (Context context, DJISDKManager.DJISDKManagerCallback callback)

Initiates the SDK.

public void registerApp ()

The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key. Subsequent app starts will use locally cached verification information to register the app.

public void setCallbackRunInUIThread (boolean enable)

Determines whether the callback should be invoked in UIThread or BackgroundThread. This method is just for setXXX and getXXX, the push callback is forced to run in the BackgroundThread.

public void setDisableCountryCodeCheck ()

Some products (Mavic Pro, Inspire 2, Phantom 4 Pro) can use 5 GHz wireless spectrum that is not permissable in some countries. By default, the 5 GHz usage is not enabled, but on registration the SDK will do a country code check to determine whether 5 GHz can be used. The check can involve sending location data to a server. This method can be used to disable this check, leaving the default configuration of only using the 2.4 GHz spectrum. Note: this method must be called before calling `+registerApp:withDelegate:` in order to take effect.

public void setSupportOnlyForBluetoothDevice (boolean isBluetoothDevice)

Change the flag if we are only connect bluetooth device. Otherwise, the default value for isSupportOnlyForBluetoothDevice is false.

Parameters
isBluetoothDevice true if the service is only for bluetooth device.

public boolean startConnectionToProduct ()

Starts a connection to the DJI product. This method should be called after successful registration of the app. `onProductChanged()` will be called if the connection succeeded.

Returns
  • true if the connection is started successfully.

public void stopConnectionToProduct ()

Disconnects the existing connection to the DJI product.

public void uploadArchivedLogs (DJICommonCallbacks.DJICompletionCallback callback)

Upload the archive to DJI. The archive will not be deleted when calling this method.