每次我都找不到结果 还向它添加了失败侦听器,但从未调用
GoogleSignInAccount googleSigninAccount =GoogleSignIn.getLastSignedInAccount(this);
int timeoutSecs = 12;
List<DataType> list = Arrays.asList(DataType.TYPE_STEP_COUNT_DELTA);
BleScanCallback bleScanCallbacks = new BleScanCallback() {
@Override
public void onDeviceFound(BleDevice device) {
// A device that provides the requested data types is available
tev.setText("Device found with: "+device.getName());
}
@Override
public void onScanStopped() {
// The scan timed out or was interrupted
tev.setText("Nothing Found");
pb.setVisibility(View.GONE);
}
};
Task<Void> response = Fitness
.getBleClient(this, googleSigninAccount)
.startBleScan(list, timeoutSecs, bleScanCallbacks );
response.addOnFailureListener(mFailureListener);
}