On Android phones, if you enable "developer" in settings, the app "fake GPS settings" can do that.
Caveat: It's been almost 4 or 5 years since I used it. I used to prank colleagues on Facebook by posting from a local prison or other weird places. Have had no use for it since I deleted my fb account. So I don't know if it can still do what you want.
Also I think the apps can check for this. It's also been several years for me but I remember using an external Bluetooth GPS receiver needed this setting to allow an app to read the BT data and feed it into Android & some Apps just refused to work.
Caveat: It's been almost 4 or 5 years since I used it. I used to prank colleagues on Facebook by posting from a local prison or other weird places. Have had no use for it since I deleted my fb account. So I don't know if it can still do what you want.