Back to project page daisy_main.
The source code is released under:
GNU General Public License
If you think the Android project daisy_main listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.uvwxy.daisy.nodemap.guicontent; /* www .ja v a 2 s .c om*/ import android.content.Context; import android.location.Location; import de.uvwxy.daisy.proto.ProtoHelper; import de.uvwxy.sensors.location.GPSWIFIReader; import de.uvwxy.sensors.location.LocationReader.LocationResultCallback; import de.uvwxy.sensors.location.LocationReader.LocationStatusCallback; public class CMLocation implements IDestroy { GPSWIFIReader locationReader = null; Location lastLocation = new Location("Dummy"); @SuppressWarnings("unused") private Context mCtx; LocationStatusCallback cbStatus = new LocationStatusCallback() { @Override public void status(Location l) { addLocation(l); } }; LocationResultCallback cbResult = new LocationResultCallback() { @Override public void result(Location l) { addLocation(l); } }; private void addLocation(Location l) { if (l != null) { CM.BUS.post(l); lastLocation = l; } } public CMLocation(Context ctx) { this.mCtx = ctx; locationReader = new GPSWIFIReader(ctx, 0, 0, cbStatus, cbResult, true, true); locationReader.startReading(); } public Location getLastLocation() { return lastLocation; } public de.uvwxy.daisy.proto.Messages.Location getLastProtoLocation() { return lastLocation != null ? ProtoHelper.androidLocationToProtoLocation(lastLocation) : null; } @Override public void destroy() { locationReader.stopReading(); } }