Hi in the below code already phone bluetooth on still it is asking me to turn on the pop-up in the below code.
嗨,在下面的代码中,已经打开了蓝牙电话,但它仍然要求我打开下面代码中的弹出窗口。
Can any one help me where I did the wrong.
谁能帮帮我,我哪里做错了。
public void checkPermissionOffline(Activity activity, String value) {
Log.d("value jyothi", value);
if (bleAdapter == null) {
final BluetoothManager bluetoothManager = (BluetoothManager) activity.getSystemService(Context.BLUETOOTH_SERVICE);
bleAdapter = bluetoothManager.getAdapter();
}
if (value != null && value.equals(String.valueOf(Constant.BLE_DISABLED))) {
requestBluetoothEnable(activity);
} else {
if (!bleAdapter.isEnabled()) {
bluetoothPermissionResult(Constant.BLE_ENABLED);
Toast.makeText(activity,"ble enabled",Toast.LENGTH_LONG).show();
} else {
bluetoothPermissionResult(Constant.BLE_DISABLED);
Toast.makeText(activity,"ble disabled",Toast.LENGTH_LONG).show();
if (bleAdapter != null && bleAdapter.isEnabled()) {
if (!hasLocationPermissions(activity)) {
Log.e(TAG, "Enphase app requesting location permission");
Timber.tag("PES").i("Enphase app requesting location permission");
requestLocationPermission(activity);
} else {
Log.e(TAG, "Enphase app requesting DeviceLocation permission");
Timber.tag("PES").i("Enphase app requesting DeviceLocation permission");
requestDeviceLocationSettings(activity);
}
} else {
requestBluetoothEnableTesting(activity);
}
}
}
}
permission no need to ask already bluetooth is on
允许没有必要问已经蓝牙是
更多回答
Welcome to Stack Overflow. Line 10 of your source code contains an error.
欢迎来到Stack Overflow。源代码的第10行包含一个错误。
优秀答案推荐
我是一名优秀的程序员,十分优秀!