Connecting to Drone

Overview

If you find any problems or bugs when you are using the tutorials, please submit a issue in the github to inform us. We are glad to receive any pull request from the Github, and help you to repair those issues. Developers can Run the Sample Application to immediately run code and see how the Yuneec Android SDK can be used. 

Connection class in the SDK provides all the different methods required to discover and connect to the drone. Make sure to connect your phone to the camera wifi. Goto phone settings and tap on Wifi and choose the appropriate network name(SSID). 

The follow code snippet demonstrates how to use Connection class in the SDK, to register to the listener and get call backs when connection status changes. The code also shows how to register to the connection listeners so that the app gets notified when the drone is discovered or when the connection times out.


Connection.Listener connectionListener = new Connection.Listener() {
       @Override
       public void onDiscoverCallback() {
           // Handle on discover     
       }

       @Override
       public void onTimeoutCallback() {
          // Handle on time out
       }
 };
Connection.addListener (connectionListener);
Connection.Result result = Connection.addConnection ();

You also need to make sure to disconnect the connection and connection listeners when the user leaves the app. It can be done by calling Connection.removeConnection ( ) in your code. Please refer the Android sample app for the complete code.