private String start( String key, boolean enableHighAccuracy, int timeout, int maximumAge, String deviceAddress) { MindSetListener listener = this.mindsetListeners.get(key); if (listener == null) { listener = new MindSetListener(this, key, timeout, deviceAddress); this.mindsetListeners.put(key, listener); } listener.start(maximumAge); return key; }
@Override public void onDestroy() { Set<Entry<String, MindSetListener>> s = this.mindsetListeners.entrySet(); Iterator<Entry<String, MindSetListener>> it = s.iterator(); while (it.hasNext()) { Map.Entry<String, MindSetListener> entry = it.next(); MindSetListener listener = (MindSetListener) entry.getValue(); listener.destroy(); } this.mindsetListeners.clear(); }
private void stop(String key) { MindSetListener listener = this.mindsetListeners.remove(key); if (listener != null) listener.stop(); }