DJI Mobile SDK Documentation

      class DJISDKManager

      class DJISDKManager
      Package:dji.sdk.sdkmanager
      Description:

      This class is the entry point for using the SDK with a DJI product. Most importantly, this class is used to register the SDK, and to connect to and access the product. This class also provides access to important feature managers (such as getKeyManager), debugging tools, and threading control of asynchronous callbacks. SDK Registration using registerApp must be successful before the SDK can be used with a DJI product.

      Class Members:

      SDK Admin

      SDK Information
      method
      method getSDKVersion
      String getSDKVersion()
      Package:dji.sdk.sdkmanager
      Description:

      Gets the DJI Mobile SDK Version. Returns SDK version as a string.

      Return:
      StringA SDK version String instance.
      App Registration
      method
      method registerApp
      void registerApp(final Context context, SDKManagerCallback callback)
      Package:dji.sdk.sdkmanager
      Description:

      The first time the app is initialized after installation, the app connects to a DJI Server through the internet to verify the Application Key. The request will include the following information:

      - App key
      - Bundle ID
      - Device UUID generated from hashed mobile device ID (getDeviceID), hashed SIM serial number (getSIMSerialNumber) and hased ANDROID ID (Secure.ANDROID_ID). If READ_PHONE_STATE permission is not permitted, a random UUID is generated.
      - System platform, version and name
      - UUID generated by platform's API ([UIDevice)
      - Mobile device model
      Subsequent app starts will use locally cached verification information to register the app when the cached information is still valid.

      Input Parameters:
      final Context contextAndroid context.
      SDKManagerCallback callbackCallback used for both the registration result, and when the products changes.
      method hasSDKRegistered
      boolean hasSDKRegistered()
      Package:dji.sdk.sdkmanager
      Description:

      Registration state.

      Return:
      booleantrue if SDK is registered.
      SDK Manager
      method
      method getInstance
      synchronized static DJISDKManager getInstance()
      Package:dji.sdk.sdkmanager
      Description:

      Accessor for DJISDKManager object.

      Return:
      synchronized static DJISDKManagerAn instance of DJISDKManager object.
      method
      method destroy
      void destroy()
      Package:dji.sdk.sdkmanager
      Description:

      Releases the resources held by the DJISDKManager. This will unsubscribe the app from any updates sent by the SDK.

      method setCallbackRunInUIThread
      void setCallbackRunInUIThread(boolean enable)
      Package:dji.sdk.sdkmanager
      Description:

      Determines whether asynchronous getter and setter method callbacks should be invoked in UIThread or BackgroundThread. This method is only for setters and getters, as push data callbacks (typically state data) always return in the BackgroundThread.

      Input Parameters:
      boolean enableA boolean value.
      AOA Connection
      method
      method closeAOAConnection
      void closeAOAConnection()
      Package:dji.sdk.sdkmanager
      Description:

      This method is used to close the AOA connection during development and should not be used in the final application. When using AS or Eclipse to build and run the application, the AOA connection is not properly closed if the application is terminated. As a result, the next time the application is run, the SDK will not be able to connect to the product without first disconnecting and reconnecting the USB cable. AS and Eclipse can be configured to invoke this method before compiling the application, closing the link before the application is run, and overcoming this problem.

      App Activation Manager
      method
      method getAppActivationManager
      AppActivationManager getAppActivationManager()
      Package:dji.sdk.sdkmanager
      Description:

      Used to check the states related to the App Activation.

      Return:
      AppActivationManagerA instance of AppActivationManager.


      Product Connection

      Product
      method
      method getProduct
      BaseProduct getProduct()
      Package:dji.sdk.sdkmanager
      Description:

      The DJI product which is connected to the mobile device, only available after successful registration of the app.

      Return:
      BaseProductA instance of BaseProduct.
      method getBluetoothProductConnector
      BluetoothProductConnector getBluetoothProductConnector()
      Package:dji.sdk.sdkmanager
      Description:

      Used to establish the Bluetooth connection between the mobile device and the DJI product. The Bluetooth connection needs to be established before a connection between the SDK and the DJI product can be made using startConnectionToProduct.

      Return:
      BluetoothProductConnectorA BluetoothProductConnector instance.
      method setSupportOnlyForBluetoothDevice
      void setSupportOnlyForBluetoothDevice(boolean isBluetoothDevice)
      Package:dji.sdk.sdkmanager
      Description:

      If only Bluetooth devices will be connected, then this should be set to true.

      Input Parameters:
      boolean isBluetoothDevicetrue if only Bluetooth devices will be connected.
      Connection
      method
      method startConnectionToProduct
      boolean startConnectionToProduct()
      Package:dji.sdk.sdkmanager
      Description:

      Starts a connection between the SDK and the DJI product. This method should be called after successful registration of the app and once there is a data connection between the mobile device and DJI product. This data connection is either a USB cable connection, a WiFi connection (that needs to be established outside of the SDK) or a Bluetooth connection (that needs to be established with getBluetoothProductConnector). If the connection succeeds, onProductConnect will be called if the connection succeeded. Returns true if the connection is started successfully. For products which connect to the mobile device using Bluetooth, getBluetoothProductConnector should be used to get a BluetoothProductConnector object which can handle Bluetooth device connection.

      Return:
      booleantrue if the connection is started successfully.
      method stopConnectionToProduct
      void stopConnectionToProduct()
      Package:dji.sdk.sdkmanager
      Description:

      Disconnect from the connected DJI product.


      Debug and Logging

      method enableBridgeModeWithBridgeAppIP
      void enableBridgeModeWithBridgeAppIP(String bridgeAppIP)
      Package:dji.sdk.sdkmanager
      Description:

      Enter debug mode with debug IP.

      Input Parameters:
      String bridgeAppIPDebug IP of the DJI Bridge App.


      Get Log Path

      Log Path
      method
      method getLogPath
      @NonNull
      String getLogPath()
      Package:dji.sdk.sdkmanager
      Description:

      Gets the path that flight logs are stored to. Flight logs are automatically generated and stored on the mobile device. The SDK does nothing with these logs, and they are provided only as a convenience for developers and users. Users can use these flight logs with DJI service centers if they are making a warranty claim. Only developers using the SDK, and users of the mobile device can access these logs. Older flight logs are overwritten by newer flight logs over time, so the flight log path is given in case an application needs to store all logs.

      Return:
      StringAn NSString object of the flight log path.


      Managers

      Fly Zones
      method
      method getFlyZoneManager
      FlyZoneManager getFlyZoneManager()
      Package:dji.sdk.sdkmanager
      Description:

      Provide access to FlyZoneManager used to manage DJI's GEO system for no fly zones.

      Return:
      FlyZoneManagerAn instance of FlyZoneManager.
      SDK Keys
      method
      method getKeyManager
      @Nullable
      KeyManager getKeyManager()
      Package:dji.sdk.sdkmanager
      Description:

      Provide access to the SDK Key interface.

      Return:
      KeyManagerAn instance of KeyManager.
      Mission Control
      method
      method getMissionControl
      MissionControl getMissionControl()
      Package:dji.sdk.sdkmanager
      Description:

      Provide access to MissionControl used to manage missions.

      Return:
      MissionControlAn instance of MissionControl.
      Video Feeder
      method
      method getFlightHubManager
      FlightHubManager getFlightHubManager()
      Package:dji.sdk.sdkmanager
      Description:

      Provide access to FlightHubManager. It can be used to interact with DJI FlightHub (https://www.dji.com/flighthub).

      Return:
      FlightHubManagerAn instance of FlightHubManager.


      LDM

      Local Data Mode
      method
      method getLDMManager
      LDMManager getLDMManager()
      Package:dji.sdk.sdkmanager
      Description:

      Manages Local Data Mode (LDM) functionality. Local data mode gives the developer the option to put the SDK into airplane mode, restricting its access to the internet. See LDMManager for details on when and where this is possible, and what is restricted.

      Return:
      LDMManagerAn instance of LDMManager.


      State Updates
      interface
      interface SDKManagerCallback
      interface SDKManagerCallback
      Package:dji.sdk.sdkmanager
      Description:

      Callback interface for SDK manager.

      Interface Methods:
      SDK Registration
      method
      method onRegister
      void onRegister(DJIError error)
      Package:dji.sdk.sdkmanager
      Description:

      Callback method after the application attempts to register.

      Input Parameters:
      DJIError errorREGISTRATION_SUCCESS if registration is successful.
      method onProductConnect
      void onProductConnect(BaseProduct product)
      Package:dji.sdk.sdkmanager
      SDK Key:ProductKey.CONNECTION
      Description:

      Called when the "product" is connected.

      Input Parameters:
      BaseProduct productProduct object. nil if the USB link or WiFi link between the product and phone is disconnected.
      method onProductDisconnect
      void onProductDisconnect()
      Package:dji.sdk.sdkmanager
      SDK Key:ProductKey.CONNECTION
      Description:

      Called when the "product" is disconnected.

      method onComponentChange
      void onComponentChange(BaseProduct.ComponentKey key, BaseComponent oldComponent, BaseComponent newComponent)
      Package:dji.sdk.sdkmanager
      SDK Key:ProductKey.CONNECTION
      Description:

      Called when a component object changes. Note: if the component is disconnected, this method will not be called, pls use ComponentListener to listen the disconnect event of any component.

      Input Parameters:
      BaseProduct.ComponentKey keyAn enum value of the ComponentKey.
      BaseComponent oldComponentAn instance of BaseComponent.
      BaseComponent newComponentAn instance of BaseComponent.