(Your should set the app as a device administrator on which the first reference below gives a solution towards it, otherwise it may cash)
Blow the microphone to extinguish the fire on the candle. If the noise is up to 70 db, the fire will be put out,then the screen will be locked.
The app start with a while loop, trying to calculate how much noise currently is. noise < 50 db , set a pic of full flame candle to the ImageView, 50db<=noise<70db, set a pic of half flame candle to the ImageView, else , set a pic of candle with no flame to the ImageView