public class MeridianLocationManager
extends java.lang.Object
A helper class to make management of the bound location services provided by the Meridian SDK simple.
This class provides a listener for receiving new locations and events requesting the user be prompted to turn on certain services depending on the location information available.
Below is a sample use in which enabling requests are shown to the user with toast messages and a the current locations string representation is displayed on the screen:
```java
Modifier and Type | Class and Description |
---|---|
static interface |
MeridianLocationManager.LocationUpdateListener
A listener for receiving notifications about updated locations, service requests or errors from the
MeridianLocationManager . |
Constructor and Description |
---|
MeridianLocationManager(android.content.Context context,
EditorKey appKey)
Constructs a LocationServiceHelper using the given Context and EditorKey.
|
MeridianLocationManager(android.content.Context context,
EditorKey appKey,
MeridianLocationManager.LocationUpdateListener listener)
Constructs a LocationServiceHelper using the given Context, EditorKey and LocationUpdateListener.
|
Modifier and Type | Method and Description |
---|---|
MeridianLocation |
getLastLocation()
Gets the last known location.
|
void |
setListener(MeridianLocationManager.LocationUpdateListener listener)
Sets the listener to receive location events.
|
boolean |
startListeningForLocation()
Binds to the location service and starts listening for new location updates.
|
void |
stopListeningForLocation()
Stops listening for locations and unbinds from the location service allowing it to clean itself up.
|
public MeridianLocationManager(android.content.Context context, EditorKey appKey)
Constructs a LocationServiceHelper using the given Context and EditorKey.
public MeridianLocationManager(android.content.Context context, EditorKey appKey, MeridianLocationManager.LocationUpdateListener listener)
Constructs a LocationServiceHelper using the given Context, EditorKey and LocationUpdateListener.
public boolean startListeningForLocation()
Binds to the location service and starts listening for new location updates. This method should be called in your Activity’s onStart method.
public void stopListeningForLocation()
Stops listening for locations and unbinds from the location service allowing it to clean itself up. This method should be called in your Activity’s onStop Method.
public void setListener(MeridianLocationManager.LocationUpdateListener listener)
Sets the listener to receive location events.
public MeridianLocation getLastLocation()
Gets the last known location.