public abstract class IALocationManager extends Object
This class provides access to IndoorAtlas location services. This classes methods must be called from the application main thread only.
Any conditions that prevent manager from running are logged with Log
using log tag IASDK
.
Basic usage:
protected void onCreate(Bundle bundle) { super.onCreate(bundle) mLocationManager = IALocationManager.create(context); } protected void onDestroy() { mLocationManager.destroy(); super.onDestroy(); } protected void onResume() { super.onResume(); mLocationManager.requestLocationUpdates(IALocationRequest.create(), this); } protected void onPause() { mLocationManager.removeLocationUpdates(this); super.onPause(); } public void onLocationChanged(IALocation location) { // do something interesting with the new update } public void onStatusChanged(String provider, int status, Bundle extras) { // do something with new status }
Modifier and Type | Field and Description |
---|---|
static int |
CALIBRATION_EXCELLENT
Calibration is not required
|
static int |
CALIBRATION_GOOD
Calibration is acceptable, but recommended
|
static int |
CALIBRATION_POOR
Calibration is required
|
static String |
EXTRA_API_KEY
Extra attribute key to configure IndoorAtlas API key at run time.
|
static String |
EXTRA_API_SECRET
Extra attribute key to configure IndoorAtlas API secret at run time.
|
static String |
EXTRA_LOCATION
Extra attribute key used when location updates are delivered in an
Intent after
requesting location updates with
requestLocationUpdates(IALocationRequest, PendingIntent) . |
static String |
EXTRA_PROXY_ADDRESS
Extra attribute key to configure SDK to use proxy address for communication.
|
static String |
EXTRA_PROXY_DISABLED
Extra attribute key to disable SDK to use proxy port for communication.
|
static String |
EXTRA_PROXY_PORT
Extra attribute key to configure SDK to use proxy port for communication.
|
static int |
STATUS_AVAILABLE
Location service running normally.
|
static int |
STATUS_CALIBRATION_CHANGED
Calibration Quality Indicator
Bundle extras: quality (Integer)CALIBRATION_POOR
CALIBRATION_GOOD
CALIBRATION_EXCELLENT
|
static int |
STATUS_LIMITED
Location service is running but with limited accuracy and functionality.
|
static int |
STATUS_OUT_OF_SERVICE
Location service is not available and the condition is not expected to resolve itself soon.
|
static int |
STATUS_TEMPORARILY_UNAVAILABLE
Location service temporarily unavailable.
|
Constructor and Description |
---|
IALocationManager() |
Modifier and Type | Method and Description |
---|---|
static IALocationManager |
create(Context context)
Recommended constructor.
|
static IALocationManager |
create(Context context,
Bundle extras)
Creates a new instance of
IALocationManager . |
abstract void |
destroy()
Release all resources allocated by this class.
|
abstract IAExtraInfo |
getExtraInfo()
Returns additional information not vital for the functionality of the SDK.
|
static String |
getVersion()
Deprecated.
Use
getExtraInfo() to obtain SDK version information. |
abstract boolean |
registerOrientationListener(IAOrientationRequest request,
IAOrientationListener listener)
Add a listener for device heading and orientation.
|
abstract boolean |
registerRegionListener(IARegion.Listener listener)
Add a listener for region events.
|
abstract boolean |
removeLocationUpdates(IALocationListener listener)
Removes all updates for the specific
listener . |
abstract void |
removeLocationUpdates(PendingIntent pendingIntent)
Removes all updates for the specific
pendingIntent . |
abstract boolean |
requestLocationUpdates(IALocationRequest request,
IALocationListener listener) |
abstract boolean |
requestLocationUpdates(IALocationRequest request,
IALocationListener listener,
Looper looper)
Register for location updates using
request and listener . |
abstract void |
requestLocationUpdates(IALocationRequest request,
PendingIntent pendingIntent)
Request location and status updates updates that are delivered to an application
component specified by a
PendingIntent . |
abstract void |
setLocation(IALocation location)
Indicate current location to positioning service.
|
abstract boolean |
unregisterOrientationListener(IAOrientationListener listener)
Remove orientation listener.
|
abstract boolean |
unregisterRegionListener(IARegion.Listener listener)
Remove region listener.
|
public static final int STATUS_OUT_OF_SERVICE
public static final int STATUS_TEMPORARILY_UNAVAILABLE
public static final int STATUS_AVAILABLE
public static final int STATUS_LIMITED
If running on Android 6.0, make sure you have checked that at least
Manifest.permission.ACCESS_COARSE_LOCATION
has been granted.
public static final int STATUS_CALIBRATION_CHANGED
quality
(Integer)public static final String EXTRA_API_KEY
create(Context, Bundle)
,
Constant Field Valuespublic static final String EXTRA_API_SECRET
create(Context, Bundle)
,
Constant Field Valuespublic static final String EXTRA_PROXY_ADDRESS
public static final String EXTRA_PROXY_PORT
public static final String EXTRA_PROXY_DISABLED
public static final String EXTRA_LOCATION
Intent
after
requesting location updates with
requestLocationUpdates(IALocationRequest, PendingIntent)
. The IALocation
is
stored as a byte array
. Please use IALocation.from(Intent)
to obtain the
IALocation
from the extras.public static final int CALIBRATION_POOR
public static final int CALIBRATION_GOOD
public static final int CALIBRATION_EXCELLENT
public static IALocationManager create(Context context)
IALocationManager
.context
- public static IALocationManager create(Context context, Bundle extras)
IALocationManager
.context
- extras
- extra arguments to service. See EXTRA_
constant fields for this class.public abstract void destroy()
create(Context)
with a corresponding call to this method. Calling any method after
calling destroy will throw a IllegalStateException
.public abstract boolean requestLocationUpdates(IALocationRequest request, IALocationListener listener, Looper looper)
request
and listener
.request
- contains parameters for location manager to choose how updates are delivered
to listenerlistener
- a IALocationListener
that's
IALocationListener.onLocationChanged(IALocation)
will be invoked on
each update. Invocations are made in main thread.looper
- a looper who's callback mechanism will be used to deliver callbacks or
null
to use main thread.IllegalArgumentException
- if request
is nullIllegalArgumentException
- if listener
is nullIllegalStateException
- if called after destroy()
has been calledpublic abstract boolean requestLocationUpdates(IALocationRequest request, IALocationListener listener)
public abstract void requestLocationUpdates(IALocationRequest request, PendingIntent pendingIntent)
Request location and status updates updates that are delivered to an application
component specified by a PendingIntent
. The location and status updates are in
the extras of the Intent
. Use IALocation.from(Intent)
to obtain the
location update.
Please see the Android documentation how to configure the PendingIntent
.
Requesting location updates with this method leaves the IndoorAtlas location service
running in the background until removeLocationUpdates(PendingIntent)
is called
with a matching PendingIntent
. Alternatively it can be killed manually by the
user or the entire process killed by Android to save resources.
request
- contains parameters for location manager to choose how updates are delivered
to listenerpendingIntent
- specifies what component is notified with location updatesIllegalArgumentException
- if request
is nullIllegalArgumentException
- if pendingIntent
is nullIllegalStateException
- if called after destroy()
has been calledEXTRA_LOCATION
public abstract boolean removeLocationUpdates(IALocationListener listener)
listener
. After call to this method, updates
will no longer be delivered to the listener.listener
- a listener object that will no longer need location updatestrue
if listener
was registered and is now removed, otherwise
false
.IllegalArgumentException
- if listener
is null
.IllegalStateException
- if called after destroy()
has been calledpublic abstract void removeLocationUpdates(PendingIntent pendingIntent)
pendingIntent
. After call to this method,
updates will no longer be delivered to the application component.pendingIntent
- a PendingIntent
that will no longer need location updates
false
.IllegalArgumentException
- if pendingIntent
is null
.IllegalStateException
- if called after destroy()
has been calledpublic abstract void setLocation(IALocation location)
location
- location indicating current positionIllegalArgumentException
- is location
is nullIllegalStateException
- if called after destroy()
has been calledpublic abstract boolean registerRegionListener(IARegion.Listener listener)
listener
- a IARegion.Listener
object to registerIllegalArgumentException
- if listener is null
IllegalStateException
- if called after destroy()
has been calledpublic abstract boolean unregisterRegionListener(IARegion.Listener listener)
listener
- a IARegion.Listener
object to be removedIllegalArgumentException
- if listener is null
IllegalStateException
- if called after destroy()
has been called@Beta public abstract boolean registerOrientationListener(IAOrientationRequest request, IAOrientationListener listener)
requestLocationUpdates(IALocationRequest, IALocationListener)
. The sensitivity of
updates is configured using IAOrientationRequest
. It is possible to receive more
frequent updates than specified in the request if there are multiple listeners. The returned
orientation represents the current best estimate and can exhibit sudden jumps. The
orientation should be be filtered if used in e.g. virtual reality applications.request
- Request indicating sensitivitylistener
- a IAOrientationListener
object to registerIllegalArgumentException
- if listener is null
IllegalStateException
- if called after destroy()
has been called@Beta public abstract boolean unregisterOrientationListener(IAOrientationListener listener)
listener
- a IAOrientationListener
object to be removedIllegalArgumentException
- if listener is null
IllegalStateException
- if called after destroy()
has been calledpublic abstract IAExtraInfo getExtraInfo()
IllegalStateException
- if called after destroy()
has been called@Deprecated public static String getVersion()
getExtraInfo()
to obtain SDK version information.