This application is based on the Boyle–Mariotte law which states that the pressure and volume of a gas have an inverse relationship, when temperature is held constant.
The basic idea is that if your device is airtight (and thus waterproof) then if you press on the screen just a bit harder than a normal press then the pressure inside increases which is then measured by the device’s pressure sensor (barometer) and the change in the pressure is the analyzed by the app.
However please do note that this should be considered as a simple practical test and even if the app will say that your device is is most likely waterproof it doesn’t mean that your device is 100% waterproof and you should refer to the device’s user manual for the correct information if it is really waterproof.
Be aware that I can’t be held liable for any damage caused to your device (eg. you cracked your screen becasue you pressed it too hard, you put your device in water despite its manual never stated that it would be waterproof, etc).