Code example for BluetoothAdapter

Methods: enable, isEnabled

0
	        // if there's no BT adapter, return without putting sensors in repository 
	        if (mBtAdapter == null) 
	        	return; 
	         
	        // and if there's no BT enabled, see if it is to be turned on automatically 
	        if (mBtAdapter.isEnabled()==false)
	        { 
	        	// does user wants BT to be enabled? 
	        	if (bt_enabled == false)
	        		return; 
	        	// shall we ask before enabling? 
				if (bt_ask==true)
				{ 
					Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
					nors.startActivity(enableIntent);
				} 
				else 
					mBtAdapter.enable();
	        } 
	        		         
		    // if it's there, add sensor 
			SensorRepository.insertSensor(new String("BT"), new String("MAC"), new String("Surrounding BT Devices"), new String("txt"), 0, 0, 1, false, 0, this);	    
			SensorRepository.insertSensor(new String("BN"), new String("#"), new String("# surrounding BT Devices"), new String("int"), 0, 0, 50, true, 0, this);