Geolocation ceases working when your phone screen goes to sleep. You can make the gps to continue to capture locations while the phone 'goes to sleep' by using a Foreground or Background extension.
The LocationSensor works without a wifi connection but the Map component requires an Internet connection.
Perhaps you could explain what you mean by 'no longer works'. Since about Android 10, Google changed the way the LocationSensor works. It now uses a 'fused' Provider. That might be the behavior you are asking about.
Please provide more information.