我已经使用新的设置API打开GPS而不离开我的应用程序。我的LocationRequest看起来是这样的:
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);LocationRequest mLocationRequest =新的LocationRequest()
一切正常,但对话框提示我也启用蓝牙(与GPS一起),有办法只启用GPS吗?
发布于 2015-12-10 07:19:18
我怀疑在您的LocationSettingsRequest中,您错误地请求BLE支持。
.addLocationRequest(mLocationRequestHighAccuracy) .addLocationRequest(mLocationRequestBalancedPowerAccuracy);=新的LocationSettingsRequest.Builder()
Builder.setNeedBle(真);
如果客户端使用BLE扫描来派生位置,则可以通过调用setNeedBle(布尔值)请求启用BLE:
如果不需要BLE,那么将其设置为false或删除这一行。
发布于 2016-05-12 15:53:56
我在这里发现了同样的问题。我必须找到一个散步的第一次打开蓝牙的意图,然后从回调请求的位置。
private boolean isBluetoothEnabled() {
if (mBluetoothAdapter != null && !mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
int REQUEST_ENABLE_BT = 1;
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
return false;
}
return true;
}https://stackoverflow.com/questions/32047882
复制相似问题