A portable inhalator device comprising: a housing comprising a mouthpiece for a user; a gas conduit coupled to the mouthpiece and configured to guide inhaling and exhaling gas flow within the device; a pressure sensor configured to monitor the gas flow in the gas conduit and to provide pressure differential signal for indicating both inhalation direction and exhalation direction of the gas flow through the gas conduit; a detection sensor configured to monitor the gas flow in the gas conduit and to provide characteristics signal for indicating composition of the gas flow through the gas conduit; a dispenser configured to dispense a drug to the gas conduit; a communication interface configured to detect an altitude of the device; at least one memory including computer program code; the at least one memory and the computer program code configured to, with at least one processor, cause the device to: receive the pressure differential signal from the pressure sensor; determine dispense control information based on the pressure differential signal, the dispense control information comprising at least one of the following: timing of dispense; and amount of the drug to be dispensed; control the dispenser to dispense the drug to the gas conduit based on the dispense control information; receive the characteristics signal indicating composition of exhaled gas flow from the detection sensor; determine adjusted control information based on the characteristics signal and the altitude of the device; and adjust the dispenser to dispense the drug to the gas conduit based on the adjusted control information. a housing comprising a mouthpiece for a user; a gas conduit coupled to the mouthpiece and configured to guide inhaling and exhaling gas flow within the device; a pressure sensor configured to monitor the gas flow in the gas conduit and to provide pressure differential signal for indicating both inhalation direction and exhalation direction of the gas flow through the gas conduit; a detection sensor configured to monitor the gas flow in the gas conduit and to provide characteristics signal for indicating composition of the gas flow through the gas conduit; a dispenser configured to dispense a drug to the gas conduit; a communication interface configured to detect an altitude of the device; at least one memory including computer program code; the at least one memory and the computer program code configured to, with at least one processor, cause the device to: receive the pressure differential signal from the pressure sensor; determine dispense control information based on the pressure differential signal, the dispense control information comprising at least one of the following: timing of dispense; and amount of the drug to be dispensed; control the dispenser to dispense the drug to the gas conduit based on the dispense control information; receive the characteristics signal indicating composition of exhaled gas flow from the detection sensor; determine adjusted control information based on the characteristics signal and the altitude of the device; and adjust the dispenser to dispense the drug to the gas conduit based on the adjusted control information. determine dispense control information based on the pressure differential signal, the dispense control information comprising at least one of the following: timing of dispense; and amount of the drug to be dispensed; timing of dispense; and amount of the drug to be dispensed; control the dispenser to dispense the drug to the gas conduit based on the dispense control information; receive the characteristics signal indicating composition of exhaled gas flow from the detection sensor; determine adjusted control information based on the characteristics signal and the altitude of the device; and adjust the dispenser to dispense the drug to the gas conduit based on the adjusted control information.