I always track my flights, so here is my experience:
App using offline maps
As it has been said, you will need an app which can download maps prior to the flight. I never had a flight with onboard wifi, but I guess, there's usually a data volume constraint, which could make it expensive.
I use Mapfactor Navigator (Android), which is an offline navigation system for cars etc.
The maps can be obtained from within the app, the user has the choice between free maps from the OpenStreetMaps project and TomTom maps, which you have to pay.
The maps can be downloaded per country, and big maps are subdivided into smaller pieces. For example, the very detailed map for Germany is divided into four parts, together about 0.8GB of data. The entire USA can be downloaded per state, all together 1.7GB.
It's possible to configure several fields at the bottom of the screen to display speed, altitude, GPS coordinates, distance to destination and so on.
I mainly use this app to explore a country (e.g. by car) on vacation, but it's also fun to use it on board to see what's that location below us.
You may switch off speed camera warning. I once got a warning over Switzerland. The 840km/h were well above the max speed limit of 120km/h, and the fine should have been in the order of seizing all property of the airline. For some reason, the pilot didn't care...
OK, lots of advantages, but there's also a drawback: The app can not just record your flight, though a menu for tracking exists. Nor can it display your currently covered track. It can only record a track when it's navigating you, but you don't want to hear "turn around! turn around!" all the time...
Tracking app
Again, there should be thousands of apps out there. I'm using Open GPS Tracker, which can also display your position / track on an online map. So, you just see a point moving on a gray screen while flying.
However, this app allows to record your track, with up to one point per second, and at the end, you can export it as GPX file, which is the standard. It can be opened by many map tools, also by googles MyMaps or what it's called. The file contains coordinates, precision, time, altitude, speed, number of satellites and course.
One hint: This app makes a sanity check between speed reported by the GPS module and speed calculated from recorded points. If this fails, it doesn't display/record any speed. This often happens onboard, so switch this check off.
Here is a flight from Düsseldorf (DUS) to Las Palmas, Gran Canaria (LPA), including altitude profile, drawn with Marble (Linux KDE program):

Precision
An airliner is usually made of aluminum, which makes it a huge faraday's cage. The reception of any radio waves is very limited (through the windows), and so is GPS.
And as GPS needs a line of sight to several satellites spread as much as possible over the entire sky, the only chance is to have a window seat. There, I usually get a very good GPS signal, while it's already very bad to unusable on the next seat, and don't even think about it on the aisle seat.
Having a window seat, I usually get a good signal. While taxiing, the precision is quite good, as on this flight from Frankfurt (FRA):

Of course, the strength and accuracy of the GPS signal relies on the quality of the GPS module of your phone. My last phone wasn't so good, I often had jumps of several 100m sidewards, or from 7000m to 10000m altitude. This is just because accuracy comes with the number of satellites, which usually increases with altitude. And: The first aim of GPS is to locate your position, the altitude usually is less important. With my current phone, I don't see such problems. No sudden steps aside, and altitude and speed were quite the same as displayed on the entertainment system.
Well, not entirely. I noticed my phone showing an altitude about 50m too high when landing on my last flight. The 20m shown by the entertainment system were plausible, as the airport was nearly on sea level / in the sea. But the too high altitude was still there, even at the beach. Keep in mind the earth isn't a sphere, it's an ellipsoid, though even that's not correct, it's more like a potato. So, sea level isn't the same everywhere. High quality/price GPS receivers know this and contain data to compensate it, but cheap ones just use the ellipsoid model. (However, 50m is nothing during flight, and what do you expect from a phone inside the cabin...)
More hints
For a working GPS, the receiver needs a list of all GPS satellites and their precise orbits ("almanach"), current time and its rough position. If it does not have its rough position, it takes much more time to get a fix (first GPS position). And if it doesn't have a recent almanach, it has to listen to the satellites for a while, as they slowly broadcast it.
As reception of radio signals is quite difficult inside the cabin, it may be very hard to get a fix, and even impossible to get the almanach.
So, it's good practice to prepare your phone before the flight, as reception will be better, and assisted-GPS allows to retrieve the almanach and current position via the mobile network.
Finally: The battery.
Running my two apps on a 4.5h flight takes about 80% battery, and I have a laaarge battery. Of course, this also depends on display-on time. But the endurance could by tested before the flight, and if it's too short, a power bank my help.