I want to get the Location object on Button press. I know the LocationListener callbacks, however they execute only after a particular time or distance. I want to get Location instantaneously. Are there any methods to do so.
You are welcome to call getLastKnownLocation()
on LocationManager
to retrieve the last known location for your requested location provider. However:
null
Hence, your code will need to be able to cope with both of those scenarios.