Skip to content

Commit

Permalink
running Android versions lower than 8.0 do not support the BLE 5.0 st…
Browse files Browse the repository at this point in the history
…andard, including extended advertising.
  • Loading branch information
qianxiansheng committed Apr 29, 2024
1 parent 7f77342 commit 50e366e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/ingchips/MyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
CrashReport.initCrashReport(getApplicationContext(), "4fbdc243d3", false);
CrashReport.initCrashReport(getApplicationContext(), "4fbdc243d3", true);
}
}
10 changes: 7 additions & 3 deletions app/src/main/java/com/ingchips/fota/BLEUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,13 @@ class BLEUtil private constructor(private val context: Context) {
}
scanCallback = callback
scanHandler.postDelayed({ stopScan() }, durationMilli)
bluetoothLeScanner!!.startScan(null,
ScanSettings.Builder().setLegacy(false).build(),
leScanCallback)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
bluetoothLeScanner!!.startScan(null,
ScanSettings.Builder().setLegacy(false).build(),
leScanCallback)
} else {
bluetoothLeScanner!!.startScan(leScanCallback)
}
}

companion object {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/ingchips/fota/Updater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ class Updater
if (plan.manualReboot)
driver!!.WriteCtrl(byteArrayOf( OTA_CTRL_REBOOT ))
//BLEUtil.disconnect(gatt!!.device)
abort()
delay(2000)
toFirstFragment()
}
Expand Down

0 comments on commit 50e366e

Please sign in to comment.