I have had some limited success with a 'gps device' whilst flying.
One of the major problems (as mentioned by the reply above) is getting enough signal(s) from the satellites to enable your GPS to plot its position. In short, you need to be next to the window, and you need to have your GPS up against the window. Of course, you will then get some strange looks by other passengers or the cabin-crew ("Hey!, all electronics must be switch-off!").
I have tried two different devices, with varying results.
I often get bored on long flights, so I resort to looking out of the window to see what is visible below. When I see things (buildings, terrain, lakes, cities, airports, whatever) of interest I try to find them on Google Earth when I get home. It's a bit 'hit-n-miss' as I'm never really sure where I am, so that's when I decided upon some kind of GPS device.
My first attempt was a GPS Tracker called a Trackstick. This is a non-descript grey oblong about the size of a spectacles-case, with just an on-off switch. You can set it up via PC to record its position every minute (or every 5, or 15, or whatever you want). On boarding, and if I get a window seat, I switch it on, put it inside a small cloth bag which I hang from the window with a small suction-cup. Also in the bag is my MP3 player, and I try to make sure that the crew can clearly see the earphone leads.
All the while we're flying the Trackstick is recording its position every 5 minutes (in my case) into its memory. As I look out of the window, If I see anything of interest I can innocently make a note of the time and details, and when I get home I can work out which are the relevant lat/longs from the Trackstick memory, and look in Google Earth.
The problem with this solution is that there is no way to get an instant read-out of your lat/long in-flight, unless you connect it to your laptop. This generally arouses suspicion ... the laptop is okay, but why is there a cable coming out the back connected to an unknown device stuck to the window!
The other solution I have used with good results is with my smart-phone. I've got an HTC running the Android OS, but maybe there's something similar for Apple iPhones?
On my phone I have a program called GPS Test. I put the phone into 'flight mode', then run the program, and put the phone into the same small cloth bag hanging from the window. The program uses the in-built gps on the phone and displays all sorts of info (speed, heading, height, UTC time, local time, etc) along with the lat/long.
If I see anything of interest outside I can quickly check and note the lat/long.
As before, once I get home I can check my notes, fire-up the PC and check Google Earth.