javax.microedition.location
Interface AreaListener


public interface AreaListener

This interface represents a listener to events associated with crossing the boundary of the given geographical area. Applications implement this interface and register it with LocationProvider.addAreaListener methods.

This listener is called when the terminal crosses the boundary of the registered geographical area. The listener is also used to notify the application about the changes in the monitoring state. The API implementation must send monitoringStateChanged notification to the registered applications each time the monitoring state changes.

The monitoringInfo notification is sent to inform the application about the currently used location method and current boundary check interval. API implementation must call this listener each time the location provider performing the area monitoring changes.

The listener is called only once when the terminal crossed the boundary of the registered geographical area. The registration is canceled when the listener is called. If the application wants to be notified again about the crossing of the boundary, it must re-register the listener.

Since:
2.0

Method Summary
 void areaEvent(GeographicArea area, Location location)
          After registering this listener with the LocationProvider, this method will be called by the platform when the implementation detects that the current location of the terminal has crossed the boundary of the registered geographical area.
 void monitoringInfo(int locationMethod, int interval)
          With this method the API implementation send information about the area monitoring to the application.
 void monitoringStateChanged(boolean isMonitoringActive)
          Called to notify that the state of the area monitoring has changed.
 

Method Detail

areaEvent

void areaEvent(GeographicArea area,
               Location location)

After registering this listener with the LocationProvider, this method will be called by the platform when the implementation detects that the current location of the terminal has crossed the boundary of the registered geographical area.

Parameters:
area - the geographical area which boundary crossing is detected
location - the current location of the terminal

monitoringStateChanged

void monitoringStateChanged(boolean isMonitoringActive)

Called to notify that the state of the area monitoring has changed. When the state of the location provider state is changed to either TEMPORARILY_UNAVAILABLE or OUT_OF_SERVICE, the API implementation must send this notification with isMonitoringActive set to false. When the state of the location provider changes to AVAILABLE, the API implementation must send this notification with isMonitoringActive set to true.

These state changes are delivered to the application as soon as possible after the state of the monitoring changes. The registered area boundary may be crossed while the location provider is unavailable.

Regardless of the new monitoring state, the AreaListener remains registered until the application explicitly removes it with LocationProvider.removeAreaListener method or areaEvent notification is sent or the application exits.

Parameters:
isMonitoringActive - A boolean indicating the new state of the area monitoring. true indicates that the area monitoring is active and false indicates that the area monitoring can not be done currently.

monitoringInfo

void monitoringInfo(int locationMethod,
                    int interval)

With this method the API implementation send information about the area monitoring to the application. This notification must be called immediately when an AreaListener is registered with LocationProvider.addAreaListener method. When the API implementation changes the location provider performing the area monitoring or the interval of the monitoring, this notification must be sent to the registered applications.

The used location method is a bitwise combination (OR) of the method technology, method type and assistance information constants defined in Location class.

Parameters:
locationMethod - the currently used location method in area monitoring
interval - the interval in which the boundary checks are made


Copyright © 2003-2008 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.