ttlock / Android_TTLock_Demo_Deprecated

19 stars 16 forks source link

错误: <匿名com.bridgedemo.TTLockModule$1>不是抽象的, 并且未覆盖TTLockCallback中的抽象方法onOperateAudioSwitch(ExtendedBluetoothDevice,int,int,int,Error) #3

Open fightingljm opened 6 years ago

fightingljm commented 6 years ago

image

// TTLockModule.java

package com.bridgedemo;

import android.util.Log;
import android.content.Context;

import com.ttlock.bl.sdk.api.TTLockAPI;
import com.ttlock.bl.sdk.util.LogUtil;
import com.ttlock.bl.sdk.callback.TTLockCallback;
import com.ttlock.bl.sdk.scanner.ExtendedBluetoothDevice;
import com.ttlock.bl.sdk.entity.Error;

import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;

import java.util.List;

/**
 * author:Liujinmeng on 2018/8/29 13:14
 */
public class TTLockModule  extends ReactContextBaseJavaModule {
    private static boolean DBG = true;
    public static Context mContext;
    public static TTLockAPI mTTLockAPI;

    @Override
    public String getName() {
        return "TTLock";
    }

    public TTLockModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    private TTLockCallback mTTLockCallback = new TTLockCallback() {   // 这一行报错
        @Override
        public void onFoundDevice(ExtendedBluetoothDevice extendedBluetoothDevice) {
            // found device and broadcast

        }
    };

    /**
     * TTLock initial
     */
    @ReactMethod
    public void initTTLock() {
        LogUtil.d("create TTLockAPI", DBG);
        mTTLockAPI = new TTLockAPI(mContext, mTTLockCallback);
    }
zjut019 commented 6 years ago

使用TTLockCallback 一定要实现里面所有的回调方法,可以使用alt+enter快捷键,自动帮你实现所有的抽象方法