GPS reception inside an airliner fuselage will be poor. Holding the phone right up to the window will help some. I've often used a handheld Garmin Etrex GPS in exactly this way.
However some airlines prohibit use of such electronic devices. If you hold a GPS device right next to a radio antenna you can in fact pick up some electronic noise, so there's a concern that there may be interference with aircraft navigation instruments.
And it goes without saying that if you are going to be using your device in "airplane" mode, then you should confirm, on the ground, that your device does in fact receive and use GPS signals when in "airplane" mode. A quick google search suggests that this normally is the case, despite the potential issue noted above.
One problem is that if you are instructed to turn the device all the way off before takeoff, then when you turn the device on later in the flight, it has to calculate its position from an incorrect assumed starting point, while moving at high speed. This can be a challenge and may take quite some time. Try not to lose the satellite lock, once you've finally acquired it.
Here are three "quora" links that include some answers from people who successfully did what you are proposing -- https://www.quora.com/Does-mobile-GPS-work-onboard-airplanes , https://www.quora.com/Why-does-GPS-work-in-airplane-mode-and-in-the-mountains-with-no-cell-tower-nearby-but-doesn-t-work-on-planes , https://www.quora.com/Why-is-it-not-possible-to-use-the-Google-Maps-satellite-GPS-when-inside-a-flying-plane