There are 2 air/ground system installed in the aircraft (air/ground system 1 and air/ground system 2) which monitor the compression of Landing Gear shock strut.
Air/Ground system supplies AIR mode & GROUND mode signal to Airplane system.
L/G status signal sends to Air/Ground system through Proximity Switch Electronic Unit(PSEU) with the help of position sensorwhich are located at Lower area of Outer cylinder of MLG (It is also called as MLG Compressed sensor).
Airplane system use this signal and relays for Air/Ground Input.
Besides this, some flight control configuration must be met.
If all the flight configuration and air/ground system parameter match, L/G wouldn’t retract and If not, then L/G would retract and accident will occure and aircraft will collapse.