Science, asked by luvkumar8074, 1 year ago

Why do we have to use locationManager.requestLocationUpdates?

Answers

Answered by snake95939528
0

LocationManager locationManager = (LocationManager)  

getSystemService(Context.LOCATION_SERVICE);

       Criteria criteria = new Criteria();

       String bestProvider =locationManager.getBestProvider(criteria,true);

       Location location =  

locationManager.getLastKnownLocation(bestProvider);

       if (location != null) {

           onLocationChanged(location);

       }

       locationManager.requestLocationUpdates(bestProvider, 20000, 0,this);

Similar questions