There are some things you have to be aware of. For example, you might think that it's enough to turn your GPS on, start your app, and see your position, as simply as that. Well, not really!
First of all, the plane shields from radio waves, so you are almost always forced to keep the phone next to (even against) the window to get your first fix. The farther you are from the window, the harder it is. After the first fix you can usually move a little, but it's hard to tell how much. Just try it. This means you'd better book a window seat.
Then, consider that there's a huge difference between a cold, a warm and a hot start. "Cold" means that your GPS has no idea where the satellites are, because you haven't used it in many days, so it must get the position of the satellites from the satellites themselves, and they transmit it slowly. When you have a data connection the phone can normally download the data from the Internet (this would be "Assisted GPS" or A-GPS), but on board a plane it's normally either not available or very expensive. So: when you are still on the ground, start your GPS app and wait until you have a fix. This will make everything faster (it's the so-called "warm" start).
One more disclaimer: for some reason the altitude measured by a GPS is not accurate at all. Once I compared it with the one shown by the plane's infotainment system, and the difference was more than 500 metres (!!!). It probably doesn't matter, but you might want to know it.
Now the bad part: GPS receivers can be very different from each other, and they can have unexpected problems.
- My first phone with integrated GPS used a receiver (SiRFstarIII) that was top-notch at the time (10 years ago!), and I think I managed to see my position 20% of the times. All the other times it was an eternal wait... The receiver was simply not good enough.
- Then I switched to a phone which used a NovaThor chip. For some reason I've never understood, it worked until the plane reached an altitude of 3950 metres, and then it suddenly stopped working. It had nothing to do with speed, it was just the height. I guess it was some kind of restriction put in place to avoid that the chip could be used to guide missiles, or something like that. Go figure. Anyway, if you happen to have a phone with such restrictions, you are out of luck. And I think the only way to find it out is trying.
- My current phone uses a Snapdragon 625 chipset, and guess what? Altitude is not a problem, but there are others! Quite often it "gets lost": for some reason you start seeing the altitude increasing very slowly (like a couple of metres every 10 seconds), until it finally hangs. Sometimes it helps to close the app and restart it, but it isn't guaranteed.
And all these phones have always worked perfectly when used in a car or on foot, which is what they are designed for. Apparently, the poor reception due to the plane's shielding, combined with the high speed and altitude, gives GPS receivers a hard time. And I don't think there's a way to know how good your GPS will work on a plane, apart from trying it.
Finally, the apps. On Android I use GPS Test. It's free, and it's great for getting the coordinates, altitude and speed, but it doesn't have maps. To see where I am I normally use TomTom with offline maps, which is also free as long as you don't use it to get directions. But obviously the maps don't cover the oceans, so you need something else.