| | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | if (mBluetoothService != null) |
| | | if (mBluetoothService != null) { |
| | | mBluetoothService.cancelScan(); |
| | | unbindService(); |
| | | } |
| | | |
| | | EventMessage msg = new EventMessage(); |
| | | msg.setType(AppConfig.SET_MAIN_CALL); |
| | | EventBus.getDefault().postSticky(msg); |
| | |
| | | } |
| | | |
| | | private void checkPermissions() { |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) |
| | | != PackageManager.PERMISSION_GRANTED) {//未开启定位权限 |
| | | //开启定位权限,200是标识码 |
| | | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 200); |
| | | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 200); |
| | | } else { |
| | | if (!isLocationEnable(this)){ |
| | | if (!isLocationEnable(this)) { |
| | | Intent locationIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); |
| | | this.startActivityForResult(locationIntent, 2); |
| | | } |