com.nutiteq.location.providers
Class LocationAPIProvider

java.lang.Object
  extended by com.nutiteq.location.providers.LocationAPIProvider
All Implemented Interfaces:
LocationSource, java.lang.Runnable, javax.microedition.location.LocationListener

public class LocationAPIProvider
extends java.lang.Object
implements java.lang.Runnable, LocationSource, javax.microedition.location.LocationListener

This is a wrapper class around JSR179


Field Summary
 
Fields inherited from interface com.nutiteq.location.LocationSource
STATUS_CANT_LOCATE, STATUS_CONNECTED, STATUS_CONNECTING, STATUS_CONNECTION_LOST
 
Constructor Summary
LocationAPIProvider(long updateInterval)
          Create location provider with given update interval (in milliseconds) and without any accuracy requirements.
LocationAPIProvider(long updateInterval, int accuracy)
           Create location provider with given update interval (in milliseconds) and without an accuracy requirement.
 
Method Summary
 void addLocationListener(LocationListener listener)
          Add listener for location coordinates
 WgsPoint getLocation()
           
 LocationMarker getLocationMarker()
          Get location marker used on screen
 int getStatus()
          Get status code for location source.
 void locationUpdated(javax.microedition.location.LocationProvider provider, javax.microedition.location.Location location)
           
 void providerStateChanged(javax.microedition.location.LocationProvider provider, int newState)
           
 void quit()
          Quit location polling
 void run()
           
 void setLocationMarker(LocationMarker marker)
          Set location marker where to push location updates
 void start()
          Start location polling
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationAPIProvider

public LocationAPIProvider(long updateInterval)
Create location provider with given update interval (in milliseconds) and without any accuracy requirements.

Parameters:
updateInterval - location update time in milliseconds

LocationAPIProvider

public LocationAPIProvider(long updateInterval,
                           int accuracy)

Create location provider with given update interval (in milliseconds) and without an accuracy requirement.

On Nokia phones this could trigger assisted positioning for faster location finding.

Parameters:
updateInterval - location update time in milliseconds
accuracy - accuracy for positioning (suggested value would be starting from 500)
Method Detail

start

public void start()
Description copied from interface: LocationSource
Start location polling

Specified by:
start in interface LocationSource

run

public void run()
Specified by:
run in interface java.lang.Runnable

getLocation

public WgsPoint getLocation()
Specified by:
getLocation in interface LocationSource

getStatus

public int getStatus()
Description copied from interface: LocationSource
Get status code for location source.

Specified by:
getStatus in interface LocationSource
Returns:
status code

getLocationMarker

public LocationMarker getLocationMarker()
Description copied from interface: LocationSource
Get location marker used on screen

Specified by:
getLocationMarker in interface LocationSource
Returns:
associated location marker

quit

public void quit()
Description copied from interface: LocationSource
Quit location polling

Specified by:
quit in interface LocationSource

setLocationMarker

public void setLocationMarker(LocationMarker marker)
Description copied from interface: LocationSource
Set location marker where to push location updates

Specified by:
setLocationMarker in interface LocationSource
Parameters:
marker - marker displayed on screen

addLocationListener

public void addLocationListener(LocationListener listener)
Description copied from interface: LocationSource
Add listener for location coordinates

Specified by:
addLocationListener in interface LocationSource
Parameters:
listener - listener to be added

locationUpdated

public void locationUpdated(javax.microedition.location.LocationProvider provider,
                            javax.microedition.location.Location location)
Specified by:
locationUpdated in interface javax.microedition.location.LocationListener

providerStateChanged

public void providerStateChanged(javax.microedition.location.LocationProvider provider,
                                 int newState)
Specified by:
providerStateChanged in interface javax.microedition.location.LocationListener