@Override public void onDestroy() { for (UserLocationDetector detector : detectors) { if (detector instanceof Serviceable) ((Serviceable) detector).close(this); } for (UserLocationPublisher publisher : publishers) { if (publisher instanceof Serviceable) ((Serviceable) publisher).close(this); } cleanUpService(); }
@Override public void onCreate() { setUpService(); for (UserLocationDetector detector : detectors) { if (detector instanceof Serviceable) ((Serviceable) detector).init(this); } for (UserLocationPublisher publisher : publishers) { if (publisher instanceof Serviceable) ((Serviceable) publisher).init(this); } locationChanged(null); for (UserLocationDetector detector : detectors) { detector.setLocationListener(this); } }