I am implementing a module which required user latitude and longitude to punch attendance offline.
I have implemented GPSTracker class followed this example on the LINK
But after enabling GPS location I am punching attendance then this class returns null location object. But after 30 to 60 sec It returns location object correctly.
I have also added COARSE
and FINE
permission in Manifest and get run time permission also.
So I need help how to get latitude and longitude instantly after enabling GPS location.
Last Known Location
. – NahshunngetLastKnownLocation
should return immediately. The only thing you should concern is that it may be out-of-date. For the current location, you have to wait for the service becoming available. There's no other chance. – Nahshunn