DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
62 stars 81 forks source link

Why there is a problem about SDKManager when I run the demo? #9

Closed yoqim closed 6 years ago

yoqim commented 8 years ago

when I run the demo,why there is a problem in application? says that:

Error:(48, 115) 错误: <匿名com.example.myapp.FPVTutorialApplication$1>不是抽象的, 并且未覆盖DJISDKManagerCallback中的抽象方法onGetRegisteredResult(DJIError)

Can you explain it?

mrjzhao commented 8 years ago

In your application, have you overriden the method onGetRegisteredResult(DJIError) ?

It seems you did not override it.

/**
 * When starting SDK services, an instance of interface DJISDKManager.DJISDKManagerCallback will be used to listen to 
 * the SDK Registration result and the product changing.
 */
private DJISDKManager.DJISDKManagerCallback mDJISDKManagerCallback = new DJISDKManager.DJISDKManagerCallback() {

    //Listens to the SDK registration result
    @Override
    public void onGetRegisteredResult(DJISDKError error) {
        if(error == DJISDKError.REGISTRATION_SUCCESS) {
            DJISDKManager.getInstance().startConnectionToProduct();
        } else {
            Handler handler = new Handler(Looper.getMainLooper());
            handler.post(new Runnable() {

                @Override
                public void run() {
                    Toast.makeText(getApplicationContext(), "register sdk fails, check network is available", Toast.LENGTH_LONG).show();
                }
            });

        }
        Log.e("TAG", error.toString());
    }

    //Listens to the connected product changing, including two parts, component changing or product connection changing.
    @Override
    public void onProductChanged(DJIBaseProduct oldProduct, DJIBaseProduct newProduct) {

        mProduct = newProduct;
        if(mProduct != null) {
            mProduct.setDJIBaseProductListener(mDJIBaseProductListener);
        }

        notifyStatusChange();
    }
};
yoqim commented 8 years ago

thanks. it works out when i change the DJISDKError in the public void onGetRegisteredResult(DJISDKError error) to DJIError. But now I can't register successfully, so have you meet the problem?

dji-dev commented 7 years ago

Hi, please check if the App Key you register in DJI developer website is put in the right place of AndroidManifest.xml file and check your android device's network and try again. For more details of registering your application using DJI SDK, please check Android Studio Project Integration Tutorial