Android 6.0 搜索不到附近蓝牙问题解决

android 6.0 扫描蓝牙设备需要权限


<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
再在代码中请求
if (Build.VERSION.SDK_INT>=23)
{
   if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
      ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 10);   }
   }
}

你可能感兴趣的:(学习笔记)