我试图在我的Android应用暂停中停止位置更新,并且我在确定如何阻止它们时遇到了一些麻烦。我知道要停止的代码是:
mLocManager.removeUpdates(locationListenerObject);
mLocManager = null;
但据我所知,我没有locationListenerObject!这是目前获取位置的代码:
LocationManager lManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
lManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 1, new LocationListener()
Location location = lManager.getLastKnownLocation(lManager.getBestProvider(criteria, false));
我怎么能阻止它运行?