Although, I guess you could just check if the landing gear is up. I'm sure there are corner cases I can't think of, but it seems like that would pretty much cover it.
While this makes sense it may have to do what the poster above you said
Lastly, I believe all electronics on the plane must be on a breaker circuit in case of electrical shorts so that pilots :can isolate and turn off faulty circuits.
https://www.google.com/search?q=highest+airport+altitude
Although, I guess you could just check if the landing gear is up. I'm sure there are corner cases I can't think of, but it seems like that would pretty much cover it.