|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.drismo.logic.LocationHandler
public class LocationHandler
This class handles everything related to receiving and distributing location updates
to listeners which requires this service. To receive location updates, add a
NewLocationListener
via the registerNewLocationListener
method. Don't forget to unregisterNewLocationListener
the listener when
finished.
NewLocationListener
,
registerNewLocationListener(NewLocationListener)
Field Summary | |
---|---|
private android.location.LocationManager |
locationManager
|
private java.util.ArrayList<NewLocationListener> |
newLocationListeners
|
Constructor Summary | |
---|---|
LocationHandler(android.location.LocationManager lm)
Constructor. |
Method Summary | |
---|---|
void |
onGpsStatusChanged(int event)
Required but not used. |
void |
onLocationChanged(android.location.Location loc)
On location change, update all the listeners! |
void |
onProviderDisabled(java.lang.String provider)
Required but not used. |
void |
onProviderEnabled(java.lang.String provider)
Required but not used. |
void |
onStatusChanged(java.lang.String provider,
int status,
android.os.Bundle arg)
Required but not used. |
void |
registerNewLocationListener(NewLocationListener listener)
Registers a new listeners, which requires location updates. |
void |
startListening()
Stars listening for GPS updates, if required. |
void |
stopListening()
Stops the GPS updates. |
void |
unregisterNewLocationListener(NewLocationListener listener)
Removes a listener from the update-list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private android.location.LocationManager locationManager
private final java.util.ArrayList<NewLocationListener> newLocationListeners
Constructor Detail |
---|
public LocationHandler(android.location.LocationManager lm)
lm
- Location manager.Method Detail |
---|
public void startListening()
public void stopListening()
public void registerNewLocationListener(NewLocationListener listener)
listener
- The listener to add.public void unregisterNewLocationListener(NewLocationListener listener)
listener
- The listener to remove.public void onLocationChanged(android.location.Location loc)
onLocationChanged
in interface android.location.LocationListener
loc
- The new location provided.NewLocationListener.onNewLocation(android.location.Location)
public void onGpsStatusChanged(int event)
onGpsStatusChanged
in interface android.location.GpsStatus.Listener
event
- not used.public void onProviderDisabled(java.lang.String provider)
onProviderDisabled
in interface android.location.LocationListener
provider
- not used.public void onProviderEnabled(java.lang.String provider)
onProviderEnabled
in interface android.location.LocationListener
provider
- not used.public void onStatusChanged(java.lang.String provider, int status, android.os.Bundle arg)
onStatusChanged
in interface android.location.LocationListener
provider
- not used.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |