I have an android app where the GUI is running on a main thread. I have a worker thread where I am trying to fetch location.
I am doing it as follows:
fusedLocationClient.requestLocationUpdates(locationRequest,
locationCallback,
null);
now, this happens at startup. If location is enabled then it works fine. we get the location and display on the app.
However, if location is off, I want the above to run continuously and invoke the callback function when we do have location (ie after location is turned on) how do we do that? It looks like requestLocationUpdates checks for location and if not enabled or not found, just exits.
I tried adding a sleep to check continously, but that hangs the app. Pls note that I am running this on a separate worker thread.
Thanks in advance!