The proper way to determine flight from GPS altitude is to lookup the ground elevation of the current location (latitude/longitude) in a database. If the GPS altitude is greater then the user is in flight (or in a tall building).
This takes a very large database but the data is available. This is probably not practical for most apps. Look for DEM data (digital elevation model) databases such as SRTM, ASTER (see here)
Another method would be to detect take off. If you are only interested in flight in jet aircraft, you would need to detect acceleration in a straight line from <10 knots to >100 knots, and then if the GPS altitude climbs by > 1000 fpm, you are likely in a jet taking off (although most prop planes can also climb >1000fpm).
Detecting all kinds of flight (airships, hot air balloons, light aircraft) gets more difficult. It's hard to distinguish between an aircraft and a car climbing mountains, though it is possible with various heuristics. It would also be difficult to distinguish a hot air balloon vs a tall building, low horizontal motion and both cases elevation is above ground level.