Is there a reliable way to mock GPS location on an Android device (rather than emulator)? I know there are several ways how to do it in the emulator, but I'd like to run my app on the device. I am not interested in existing apps like "Fake GPS location" etc., I want to get my hands dirty by logging actual GPS data and then "playing" it back with various adjustments, so I need to write my own code.
I see on my Android 7.0 device that there is a setting "Select mock location app" under the Developer options in Settings. Strangely, it lets me to select Samsung "Messages" app as the mocker app, I can't imagine why and how exactly this app would do the location mocking. Anyway, it seems that if I learn how to manifest in my code that I want to mock GPS location, my app would hopefully appear in this list available for selection.
I read that things have changed in this area over years, so online references might not be up-to-date and bring more confusion than help.