Source:
<code>public void onCreate() { super.onCreate(); <START> if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){ <END> bluetoothAdapter = ((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter(); if(bluetoothAdapter == null) return; } notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); DATABASE_TABLES = Bluetooth_Provider.DATABASE_TABLES; TABLES_FIELDS = Bluetooth_Provider.TABLES_FIELDS; CONTEXT_URIS = new Uri[]{Bluetooth_Sensor.CONTENT_URI, Bluetooth_Data.CONTENT_URI}; IntentFilter filter = new IntentFilter(); filter.addAction(Bluetooth.ACTION_AWARE_BLUETOOTH_REQUEST_SCAN); filter.addAction(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); registerReceiver(bluetoothMonitor, filter); Intent backgroundService = new Intent(ACTION_AWARE_BLUETOOTH_REQUEST_SCAN); bluetoothScan = PendingIntent.getBroadcast(this, 0, backgroundService, PendingIntent.FLAG_UPDATE_CURRENT); REQUIRED_PERMISSIONS.add(Manifest.permission.BLUETOOTH); REQUIRED_PERMISSIONS.add(Manifest.permission.BLUETOOTH_ADMIN); REQUIRED_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION); enableBT = new Intent(this, Bluetooth.class); enableBT.putExtra("action", ACTION_AWARE_ENABLE_BT); if (!bluetoothAdapter.isEnabled()) { notifyMissingBluetooth(getApplicationContext()); } if (Aware.DEBUG) Log.d(TAG, "Bluetooth service created!"); }</code><technical_language>is this SDK check needed? line 61 load default adapter</technical_language>

Target:
public void onCreate() { super.onCreate(); alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); bluetoothAdapter = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)? ((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter() : BluetoothAdapter.getDefaultAdapter(); if(bluetoothAdapter == null) return; notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); DATABASE_TABLES = Bluetooth_Provider.DATABASE_TABLES; TABLES_FIELDS = Bluetooth_Provider.TABLES_FIELDS; CONTEXT_URIS = new Uri[]{Bluetooth_Sensor.CONTENT_URI, Bluetooth_Data.CONTENT_URI}; IntentFilter filter = new IntentFilter(); filter.addAction(Bluetooth.ACTION_AWARE_BLUETOOTH_REQUEST_SCAN); filter.addAction(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); registerReceiver(bluetoothMonitor, filter); Intent backgroundService = new Intent(ACTION_AWARE_BLUETOOTH_REQUEST_SCAN); bluetoothScan = PendingIntent.getBroadcast(this, 0, backgroundService, PendingIntent.FLAG_UPDATE_CURRENT); REQUIRED_PERMISSIONS.add(Manifest.permission.BLUETOOTH); REQUIRED_PERMISSIONS.add(Manifest.permission.BLUETOOTH_ADMIN); REQUIRED_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION); enableBT = new Intent(this, Bluetooth.class); enableBT.putExtra("action", ACTION_AWARE_ENABLE_BT); if (!bluetoothAdapter.isEnabled()) { notifyMissingBluetooth(getApplicationContext(), false); } if (Aware.DEBUG) Log.d(TAG, "Bluetooth service created!"); }