var mScanCallback = plus.android.implements("android.bluetooth.BluetoothAdapter.LeScanCallback", {
"onLeScan": function(device, rssi, scanRecord) {
if(device != null) {
console.log("mScanCallback enter");
}
}
});
function scanARDWifi() {
console.log("scanARDWifi enter");
plus.android.importClass(BAdapter);
if(mScanCallback == null) {
console.log("mScanCallback is null");
}
BAdapter.startLeScan(mScanCallback);
}
调用scanARDWifi函数:
scanARDWifi enter at index.html:83
Uncaught Attempt to read from field 'java.lang.Class io.dcloud.invocation.c.b' on a null object reference;at android.bluetooth.BluetoothAdapter.startLeScan at index.html:1
看提示是空指针错误,搞不明白哪里有空指针的可能,给点提示?
如果不加回调
BAdapter.startLeScan(null);
这样就不报错,可没实际意义。
s***@qq.com
给个正确的例子啊?谢谢
2016-09-21 14:48