![](/img/trans.png)
[英]Glucose measurement from cordova-plugin-ble-central Accu Chek Mobile
[英]Issue with the cordova plugin ble-central
我是 Ionic 框架世界的新手,我正在使用藍牙低能耗(cordova 插件 ble-central)開發一個 Ionic 應用程序。 直到兩天前,一切都運行良好。 現在, scan()
function 不再起作用了。 正確調用了function,允許藍牙和定位權限。 我沒有對我的代碼進行任何更改來解釋這個問題。 我也試過卸載/安裝應用程序,重啟我的 android 手機,還使用了另一部手機。 沒有工作。
下面是我的清單的片段:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-feature android:name="android.hardware.location.gps" />
和藍牙代碼:
this.ble.scan([], 5).subscribe(
device =>
this.onDeviceDiscovered(device),// Never reached
error => {
this.scanError(error).catch(e => console.log('scan error ' + e)); // Never reached
},
() => console.log('completed')); // Never reached
// Debug
setTimeout(this.setStatus.bind(this), 6000, 'Scan completed');
function setStatus
用於調試。
我已經閱讀並嘗試了很多東西,但沒有任何效果。 謝謝你的幫助!
PS:當然,當我使用我的應用程序時,藍牙和 gps 是活動的。
自 android api 29 起,使用 ACCESS_FINE_LOCATION 權限代替 ACCESS_COARSE_LOCATION。 cordova-plugin-ble-central 的維護者尚未接受糾正此問題的拉取請求。
我對叉子進行了必要的更改,現在它在 android 10、api 29 上運行良好...
也許您可以通過刪除舊的來使用它:
ionic cordova plugin rm cordova-plugin-ble-central
並添加我的叉子:
ionic cordova plugin add git+https://github.com/dslima90/cordova-plugin-ble-central.git
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.