YITechnology / YIOpenAPI

YI Open API provides mobile SDKs and reference designs for software developers and hardware makers to build cool apps and products with YI 4K Action Cameras
Other
346 stars 77 forks source link

Can't connect with camera #23

Closed dureo closed 7 years ago

dureo commented 7 years ago

I'm trying to conenct with a camera but onConnected() or onClosed() are never called.

I create ActionCamera like this

`ac1 = new ActionCamera(new ActionCameraListener() { @Override public void onConnected() { super.onConnected(); connFeedback.setText("Connected to camera " + SSID1); }

        @Override
        public void onClosed(Error error) {
            super.onClosed(error);
            connFeedback.setText("Error connecting to camera " + SSID1 + ": " + error.toString());
        }
    }, new DispatchQueue() {
        @Override
        public void dispatch(Runnable runnable) {

        }
    });`

and try to connect with this camera using ac1.connect("tcp:" + ip + ":7878");

I'm sure that ip is correct (I tested it) but nothing happens with ActionCameraListener. However, dispatch() is being called .

Anyone can help me? thanks

lrhymes commented 7 years ago

You need to tell it where to send runnable. The UI cause ur trying to update the UI in the callbacks? Noob here...am I right?

dureo commented 7 years ago

Ok, now it works and I understand it better, thanks.

Asad1234567 commented 6 years ago

Please tell me what u used inside disatch function?