|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.util.LifeCycleObjectImpl
de.unikassel.android.sdcframework.devices.LocationTracker
public final class LocationTracker
Class to track location information using available sensors.
Field Summary | |
---|---|
private Context |
context
the application context |
private Location |
currentLocation
The current Location |
private boolean |
enabled
Enabled flag |
private static int |
SIGNIFICANT_TIME_DIFF
The time difference for significance |
Constructor Summary | |
---|---|
LocationTracker()
Constructor |
Method Summary | |
---|---|
Location |
getCurrentLocation()
Getter for the currentLocation |
private void |
getLastKnownLocation()
Method to get the last known location |
private static boolean |
isBetterLocation(Location location,
Location currentBestLocation)
Determines whether one Location reading is better than the current Location fix ( source: http://developer.android.com/guide/topics/location/obtaining-user -location.html ) |
boolean |
isEnabled()
Getter for the enabled |
private static boolean |
isSameProvider(String provider1,
String provider2)
Method to check for the same provider |
private Location |
locationFromSample(Sample sample)
Method to create a location object from a location sample |
void |
onCreate(Context applicationContext)
Creation method |
void |
onEvent(ObservableEventSource<? extends Sample> eventSource,
Sample observedEvent)
This method is called whenever the observed object does create an observed event |
private void |
setCurrentLocation(Location currentLocation)
Setter for the currentLocation |
void |
setEnabled(boolean enabled)
Setter for the enabled |
Methods inherited from class de.unikassel.android.sdcframework.util.LifeCycleObjectImpl |
---|
onDestroy, onPause, onResume |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int SIGNIFICANT_TIME_DIFF
private Location currentLocation
private boolean enabled
private Context context
Constructor Detail |
---|
public LocationTracker()
Method Detail |
---|
public final void onCreate(Context applicationContext)
LifeCycleObject
onCreate
in interface LifeCycleObject
onCreate
in class LifeCycleObjectImpl
applicationContext
- the application contextprivate void getLastKnownLocation()
private static final boolean isBetterLocation(Location location, Location currentBestLocation)
location
- the new locationcurrentBestLocation
- the current locationprivate static final boolean isSameProvider(String provider1, String provider2)
provider1
- first providerprovider2
- second provider
public final void onEvent(ObservableEventSource<? extends Sample> eventSource, Sample observedEvent)
EventObserver
onEvent
in interface EventObserver<Sample>
eventSource
- the event generatorobservedEvent
- the event created by the observed objectprivate final Location locationFromSample(Sample sample)
sample
- the sample
private final void setCurrentLocation(Location currentLocation)
currentLocation
- the currentLocation to setpublic final Location getCurrentLocation()
public void setEnabled(boolean enabled)
enabled
- the enabled to setpublic boolean isEnabled()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |