Skip to content

Commit

Permalink
搜索前权限判断优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wandersnail committed Nov 15, 2024
1 parent a0cb219 commit 6a562f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ signing {
sign configurations.archives
}

def lib_version = '1.5.1'
def lib_version = '1.5.2'
def user_name = 'wandersnail'
def lib_group = 'cn.wandersnail'
def lib_artifact = 'easyble-x'
Expand Down
14 changes: 13 additions & 1 deletion library/src/main/java/cn/wandersnail/ble/EasyBLE.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
Expand Down Expand Up @@ -450,15 +451,26 @@ public boolean isScanning() {
}

/**
* 搜索BLE设备
* 搜索BLE设备。部分机型使用此方法无法正确判断出是否拥有相应的权限,请使用{@link #startScan(Activity)}
*/
@Deprecated
public void startScan() {
checkAndInstanceScanner();
if (checkStatus() && scanner != null) {
scanner.startScan(application);
}
}

/**
* 搜索BLE设备
*/
public void startScan(@NonNull Activity activity) {
checkAndInstanceScanner();
if (checkStatus() && scanner != null) {
scanner.startScan(activity);
}
}

/**
* 停止搜索
*/
Expand Down

0 comments on commit 6a562f2

Please sign in to comment.