Commit ba851b6271beb897cc228cc350993c35f283e27a

Authored by YangShuai
1 parent 034e8d08

1 修复搜索设备页空指针问题

config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "0.3.19",
  24 + version: "0.3.20",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.module",
27 27 //Lib库名称
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SearchDevicefragment.java
... ... @@ -89,15 +89,17 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen
89 89 * 初始化蓝牙扫描
90 90 */
91 91 private void initBlueToothScanConfig() {
92   - BleManager.getInstance().init(getActivity().getApplication());
93   - BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
  92 + if (null != getActivity().getApplication()) {
  93 + BleManager.getInstance().init(getActivity().getApplication());
  94 + BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
94 95 // .setServiceUuids(serviceUuids) // 只扫描指定的服务的设备,可选
95 96 // .setDeviceName(true, names) // 只扫描指定广播名的设备,可选
96 97 // .setDeviceMac(mac) // 只扫描指定mac的设备,可选
97 98 // .setAutoConnect(isAutoConnect) // 连接时的autoConnect参数,可选,默认false
98   - .setScanTimeOut(1000 * 60) // 扫描超时时间,可选,默认10秒;小于等于0表示不限制扫描时间
99   - .build();
100   - BleManager.getInstance().initScanRule(scanRuleConfig);
  99 + .setScanTimeOut(1000 * 60) // 扫描超时时间,可选,默认10秒;小于等于0表示不限制扫描时间
  100 + .build();
  101 + BleManager.getInstance().initScanRule(scanRuleConfig);
  102 + }
101 103 }
102 104  
103 105 @Override
... ...