Struggling to connect manually to my Anafi in Android

I have a working app using the sdk when using the ManagedGroundSdk.obtainSession(this);

Now I want to try to connect to the drone without the Managed part, because I want to completely disconnect from the drone, connect with something else and then be able to reconnect again later without restarting the app. However I don’t seem to be able to connect. Drone connect always returns false, if I pass it a connector or not. I feel like I’m missing something, like I was supposed to connect a device somewhere or something. I do get a return from groundsdk.getDroneList that seems reasonable and has my Anafi in there.

Am I missing something? This is my connect code below.

 groundsdk = GroundSdk.newSession(getApplicationContext(), savedInst);
        groundsdk.resume();

        Ref <List <RemoteControlListEntry>> remotes = groundsdk.getRemoteControlList(it -> true,new Ref.Observer<List<RemoteControlListEntry>>() {
            @Override
            public void onChanged(@Nullable List<RemoteControlListEntry> obj) {

            }

        });

        Ref <List <DroneListEntry>> drones = groundsdk.getDroneList(it -> true,new Ref.Observer<List<DroneListEntry>>() {
            @Override
            public void onChanged(@Nullable List<DroneListEntry> obj) {

            }
            });

        DroneListEntry droneEntry = drones.get().get(0);
        Log.d(TAG, "Found a " + droneEntry.getName() + " " + droneEntry.getModel());
        drone = groundsdk.getDrone(droneEntry.getUid());
        DeviceConnector[] conns = drone.getState().getConnectors();
        DeviceConnector conn = DeviceConnectorCore.createLocalConnector(DeviceConnector.Technology.WIFI);
        //DeviceConnector conn = DeviceConnectorCore.createRCConnector(d[roneEntry.getUid());

        DeviceState state = drone.getState();
        Log.e(TAG, "Found " + state.getConnectors().length + " connectors");
        //if(!drone.connect(conn)){
        if(!drone.connect()){
            Log.e(TAG, "Drone failed to connect probably no connector");
        }

This topic was automatically closed after 30 days. New replies are no longer allowed.