Class MeridianLocationManager
java.lang.Object
com.arubanetworks.meridian.location.MeridianLocationManager
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A listener for receiving notifications about updated locations, service requests or errors from theMeridianLocationManager
. -
Constructor Summary
ConstructorDescriptionMeridianLocationManager
(Context context, EditorKey appKey) Constructs a LocationServiceHelper using the given Context and EditorKey.MeridianLocationManager
(Context context, EditorKey appKey, MeridianLocationManager.LocationUpdateListener listener) Constructs a LocationServiceHelper using the given Context, EditorKey and LocationUpdateListener. -
Method Summary
Modifier and TypeMethodDescriptionGets the last known location.void
Resets the location manager.void
Sets the listener to receive location events.boolean
Binds to the location service and starts listening for new location updates.void
Stops listening for locations and unbinds from the location service allowing it to clean itself up.
-
Constructor Details
-
MeridianLocationManager
Constructs a LocationServiceHelper using the given Context and EditorKey. -
MeridianLocationManager
public MeridianLocationManager(Context context, EditorKey appKey, MeridianLocationManager.LocationUpdateListener listener) Constructs a LocationServiceHelper using the given Context, EditorKey and LocationUpdateListener.
-
-
Method Details
-
startListeningForLocation
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.
-
stopListeningForLocation
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.
-
resetLocationManager
public void resetLocationManager()Resets the location manager.In general this should not be called. Only use it if system conditions have changed since starting the location manager. For example, if the user accepted location permission while location manager is running.
-
setListener
Sets the listener to receive location events. -
getLastLocation
Gets the last known location.
-