On most commercial aircraft, you'll have a hard time.There's just not enough window space and the aluminum skin of the aircraft blocks the GPS signals. And if you follow the rules and turn off electronic devices, you'll lose the fix that you had when you had on the ground. This makes it even harder for the GPS to lock.
Most phones will have trouble getting GPS signals without a cell connection since they are designed to rely on the availability of data network assisted GPS most of the time.
And finally, a...
more... physical altitude limit may not apply on aircraft. However, I believe there's also, interestingly, an intentional technical limit on what most GPSs can do. The reason for this is that the US government doesn't want Iran and North Korea etc to be able to build missiles that use GPS for guidance, so they have mandated that GPS chips should not work at heights or speeds that are clearly in typical range of what aircraft can do.
Hope that's useful.....