public class MapLocationManager
extends java.lang.Object
DeviceLocationListener
and GoogleLocationListener
} to result the best location.Modifier and Type | Field and Description |
---|---|
static short |
MODE_SINGLE |
static short |
MODE_UPDATE |
static short |
STATUS_IDLE |
static short |
STATUS_SINGLE |
static short |
STATUS_UPDATE |
Constructor and Description |
---|
MapLocationManager(Context context,
Map map) |
Modifier and Type | Method and Description |
---|---|
void |
cancelGetCurrentLocation(boolean onlyInUpdateMode)
Cancel getting location operation.
|
boolean |
getSingleCurrentLocation()
Get current location for one time with out automatically update current location.
|
short |
getStatus() |
void |
getUpdateLocation()
Get current location in period, location will be updated automatically.
|
static boolean |
isBetterLocation(Location location,
Location currentBestLocation)
Determines whether one Location reading is better than the current Location fix
|
boolean |
isDeviceSensorAvailable() |
boolean |
isGooglePlayAvailable() |
boolean |
isLocationAvailable() |
void |
onGetNewLocation(Location location)
This method will be called by location listeners:
DeviceLocationListener and GoogleLocationListener when they
receive better current location than one they have. |
public static final short MODE_SINGLE
public static final short MODE_UPDATE
public static final short STATUS_IDLE
public static final short STATUS_SINGLE
public static final short STATUS_UPDATE
public MapLocationManager(Context context, Map map)
public boolean isGooglePlayAvailable()
public boolean isDeviceSensorAvailable()
public boolean isLocationAvailable()
public boolean getSingleCurrentLocation()
onGetNewLocation(Location)
of this class.
This operation will be terminated automatically after 2 minutes.public void getUpdateLocation()
public void cancelGetCurrentLocation(boolean onlyInUpdateMode)
public void onGetNewLocation(Location location)
DeviceLocationListener
and GoogleLocationListener
when they
receive better current location than one they have. Then, this class will decide if the received location is better than one
one this class has or not. If yes, this location will be pass to map.location
- public short getStatus()
public static boolean isBetterLocation(Location location, Location currentBestLocation)
location
- The new Location that you want to evaluatecurrentBestLocation
- The current Location fix, to which you want to compare the new one