use of com.codename1.location.LocationListener in project CodenameOne by codenameone.
the class IOSImplementation method locationUpdate.
/**
* Callback for native
*/
public static void locationUpdate() {
if (lm != null) {
final LocationListener ls = lm.getActiveLocationListener();
lm.setStatus();
if (ls != null) {
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
ls.locationUpdated(lm.getCurrentLocation());
}
});
}
}
}
use of com.codename1.location.LocationListener in project CodenameOne by codenameone.
the class StubLocationManager method bindListener.
@Override
protected void bindListener() {
checkLocationRegistration();
setStatus(AVAILABLE);
final LocationListener l = getLocationListener();
task = new TimerTask() {
@Override
public void run() {
Display.getInstance().callSerially(new Runnable() {
public void run() {
Location loc;
try {
loc = getCurrentLocation();
if (JavaSEPort.locSimulation == null) {
loc.setLongitude(loc.getLongitude() + 0.001);
loc.setLatitude(loc.getLatitude() + +0.001);
} else {
int s = JavaSEPort.locSimulation.getState();
if (s != StubLocationManager.super.getStatus()) {
l.providerStateChanged(s);
setStatus(s);
}
}
l.locationUpdated(loc);
} catch (IOException ex) {
Logger.getLogger(StubLocationManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
};
timer = new Timer();
timer.schedule(task, 3000, 3000);
}
Aggregations