原文:https://blog.csdn.net/uyy203/article/details/50771434
private void unceasingDiscovery(){
final Timer mTimer=new Timer();
TimerTask mTimerTask=new TimerTask() {
@Override
public void run() {
// TODO 自动生成的方法存根
if(mBluetoothAdapter.isDiscovering())
mBluetoothAdapter.cancelDiscovery();
else
mBluetoothAdapter.startDiscovery();
}
};
//开始一个定时任务,延时500ms,周期为800ms
mTimer.schedule(mTimerTask, 500,800);
}
网友评论