com.nutiteq.location.providers
Class AndroidGPSProvider

java.lang.Object
  extended by com.nutiteq.location.providers.AndroidGPSProvider
All Implemented Interfaces:
android.location.LocationListener, LocationSource

public class AndroidGPSProvider
extends java.lang.Object
implements LocationSource, android.location.LocationListener

Location provider wrapped around Android GPS implementation. At the moment supports only WGS coordinates retrieval.


Field Summary
 
Fields inherited from interface com.nutiteq.location.LocationSource
STATUS_CANT_LOCATE, STATUS_CONNECTED, STATUS_CONNECTING, STATUS_CONNECTION_LOST
 
Constructor Summary
AndroidGPSProvider(android.location.LocationManager locationManager, long updateInterval)
          Create new location provider using hybrid (ie. network+GPS) positioning.
AndroidGPSProvider(android.location.LocationManager locationManager, java.lang.String provider, long updateInterval)
          Create new location provider using defined Android positioning option.
 
Method Summary
 void addLocationListener(LocationListener listener)
          Add listener for location coordinates
static android.location.Criteria createCoarseCriteria()
          this criteria will settle for less accuracy, high power, and cost
static android.location.Criteria createFineCriteria()
          this criteria needs high accuracy, high power, and cost
 WgsPoint getLocation()
           
 LocationMarker getLocationMarker()
          Get location marker used on screen
 java.lang.String getMethod()
          Method of positioning, depending on implementation e.g.
 java.lang.Object getNativeLocation()
          Provides native location object with last info, e.g.
 int getStatus()
          Get status code for location source.
 void onLocationChanged(android.location.Location location)
           
 void onProviderDisabled(java.lang.String provider)
           
 void onProviderEnabled(java.lang.String provider)
           
 void onStatusChanged(java.lang.String provider, int status, android.os.Bundle extras)
           
 void quit()
          Quit location polling
 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

AndroidGPSProvider

public AndroidGPSProvider(android.location.LocationManager locationManager,
                          long updateInterval)
Create new location provider using hybrid (ie. network+GPS) positioning.

Parameters:
locationManager - Android location manager
updateInterval - update interval

AndroidGPSProvider

public AndroidGPSProvider(android.location.LocationManager locationManager,
                          java.lang.String provider,
                          long updateInterval)
Create new location provider using defined Android positioning option.

Parameters:
locationManager - android location manager
provider - used provider (either LocationManager.GPS_PROVIDER or LocationManager.NETWORK_PROVIDER)
updateInterval - update interval
Method Detail

createCoarseCriteria

public static android.location.Criteria createCoarseCriteria()
this criteria will settle for less accuracy, high power, and cost


createFineCriteria

public static android.location.Criteria createFineCriteria()
this criteria needs high accuracy, high power, and cost


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

getLocation

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

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

getStatus

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

Specified by:
getStatus in interface LocationSource
Returns:
status code

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

start

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

Specified by:
start in interface LocationSource

onLocationChanged

public void onLocationChanged(android.location.Location location)
Specified by:
onLocationChanged in interface android.location.LocationListener

onProviderDisabled

public void onProviderDisabled(java.lang.String provider)
Specified by:
onProviderDisabled in interface android.location.LocationListener

onProviderEnabled

public void onProviderEnabled(java.lang.String provider)
Specified by:
onProviderEnabled in interface android.location.LocationListener

onStatusChanged

public void onStatusChanged(java.lang.String provider,
                            int status,
                            android.os.Bundle extras)
Specified by:
onStatusChanged in interface android.location.LocationListener

getMethod

public java.lang.String getMethod()
Description copied from interface: LocationSource
Method of positioning, depending on implementation e.g. "GPS", "AGPS" etc Useful for debugging

Specified by:
getMethod in interface LocationSource
Returns:
used location method as string

getNativeLocation

public java.lang.Object getNativeLocation()
Description copied from interface: LocationSource
Provides native location object with last info, e.g. Location in JSR-172

Specified by:
getNativeLocation in interface LocationSource
Returns:
implementation-specific Object holding last location