Open fightingljm opened 6 years ago
// 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); }
使用TTLockCallback 一定要实现里面所有的回调方法,可以使用alt+enter快捷键,自动帮你实现所有的抽象方法