dji-sdk / Mobile-UXSDK-Android

DJI Mobile UXSDK is a suite of product agnostic UI objects that fast tracks the development of Android applications using the DJI Mobile SDK.
Other
152 stars 110 forks source link

Register application : not responding #108

Open jimmyfraiture opened 3 years ago

jimmyfraiture commented 3 years ago

Hello, When I try to register my application with `DJISDKManager.getInstance().registerApp(MainActivity.this.getApplicationContext(), new DJISDKManager.SDKManagerCallback() { @Override public void onRegister(DJIError djiError) { if (djiError == DJISDKError.REGISTRATION_SUCCESS) { showToast("Register Success"); Log.d("DJI SDK", "Registered"); DJISDKManager.getInstance().startConnectionToProduct(); } else { Log.e("DJI SDK", "Registration failed"); showToast("Register sdk fails, please check the bundle id and network connection!"); } Log.v(TAG, djiError.getDescription()); }

                    @Override
                    public void onProductDisconnect() {
                        Log.d(TAG, "onProductDisconnect");
                        showToast("Product Disconnected");
                        notifyStatusChange();
                    }
                    @Override
                    public void onProductConnect(BaseProduct baseProduct) {
                        Log.d(TAG, String.format("onProductConnect newProduct:%s", baseProduct));
                        showToast("Product Connected");
                        notifyStatusChange();
                    }

                    @Override
                    public void onProductChanged(BaseProduct baseProduct) {

                    }

                    @Override
                    public void onComponentChange(BaseProduct.ComponentKey componentKey, BaseComponent oldComponent, BaseComponent newComponent) {
                        if (newComponent != null) {
                            newComponent.setComponentListener(new BaseComponent.ComponentListener() {
                                @Override
                                public void onConnectivityChange(boolean isConnected) {
                                    Log.d(TAG, "onComponentConnectivityChanged: " + isConnected);
                                    notifyStatusChange();
                                }
                            });
                        }
                        Log.d(TAG, String.format("onComponentChange key:%s, oldComponent:%s, newComponent:%s", componentKey, oldComponent,newComponent));
                    }
                    @Override
                    public void onInitProcess(DJISDKInitEvent djisdkInitEvent, int i) {

                    }

                    @Override
                    public void onDatabaseDownloadProgress(long l, long l1) {

                    }
                });`

The application run for ever without calling the onRegister function. Is it a known issue or is it a solution? (all my permissions are granted)

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #41771:

Dear Client Thank you for contacting DJI.

What is the error message looks like? Have you apply an appkey and insert it into the AndroidManifest.xml? Please try with the github demo it should work.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

Devoney commented 1 year ago

I am experiencing sort of the same thing. The application starts, the debugger hits

DJISDKManager.getInstance().registerApp(getApplicationContext(), mDJISDKManagerCallback);

But the following is never called back:

public void onRegister(DJIError error) {

And the DJI mini go app never connects to the aircraft.

EDIT: The unmodified version of the code, when downloaded straight from Github, seems to have a bug: The callback is defined only after it was passed along to the registerApp method. Hence the registerApp method got null and never calls anything back. So make sure the callback is defined before calling registerApp.