public class AntService
extends java.lang.Object
bindService()
you allow communication with the
ANT Radio Service.
This class provides the interface that applications use to request connections to various components of the ANT Radio Service. Unlike standard system services which are always running, the ANT Radio Service will preserve resources by only running while an application is bound to it. For this reason you must stay bound with the ANT Radio Service at all times you are using a component.
Currently available components are:
Modifier and Type | Class and Description |
---|---|
static class |
AntService.Component
Used internally by the API.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_BIND_ANT_RADIO_SERVICE
Use this as the action parameter of a binding intent get a service interface back which
can be wrapped by an
AntService object. |
static int |
SERVICE_VERSION_CODE_NOT_INSTALLED
The value returned by
getVersionCode(Context) if ANT Radio
Service is not installed. |
static int |
SERVICE_VERSION_CODE_NOT_YET_KNOWN
The value returned by
getVersionCode(Context) if ANT Radio
Service is unknown. |
Constructor and Description |
---|
AntService(IBinder binder)
Creates a new
AntService using the binding obtained from bindService(Context, ServiceConnection) to communicate with the ANT Radio service. |
Modifier and Type | Method and Description |
---|---|
static boolean |
bindService(Context bindContext,
ServiceConnection conn)
Connect to the ANT Radio Service, creating it if needed.
|
static void |
displayAntSettings(Context context)
Starts the ANT settings system settings activity.
|
AntAdapterProvider |
getAdapterProvider()
Provides a connection to the Adapter Provider component in the ANT Radio
Service.
|
AntChannelProvider |
getChannelProvider()
Provides a connection to the Channel Provider component in the ANT Radio Service.
|
static int |
getVersionCode(Context context)
Gets the version code for ANT Radio Service.
|
static java.lang.String |
getVersionName(Context context)
Gets the version name for ANT Radio Service.
|
static boolean |
hasAdapterProviderSupport()
Used internally by the ANT API.
|
static boolean |
hasAdapterWideConfigurationSupport()
Used internally by the ANT API.
|
static boolean |
hasContinuousScanSupport()
Used internally by the ANT API.
|
static boolean |
requiresBundle()
Used internally by the ANT API.
|
public static final java.lang.String ACTION_BIND_ANT_RADIO_SERVICE
AntService
object.public static final int SERVICE_VERSION_CODE_NOT_YET_KNOWN
getVersionCode(Context)
if ANT Radio
Service is unknown.public static final int SERVICE_VERSION_CODE_NOT_INSTALLED
getVersionCode(Context)
if ANT Radio
Service is not installed.public AntService(IBinder binder)
AntService
using the binding obtained from bindService(Context, ServiceConnection)
to communicate with the ANT Radio service.
This binding should be acquired by using
ACTION_BIND_ANT_RADIO_SERVICE
binder
- The service binding used to talk to the ANT Radio service.public static boolean requiresBundle()
public static boolean hasAdapterWideConfigurationSupport()
public static boolean hasContinuousScanSupport()
public static boolean hasAdapterProviderSupport()
public static boolean bindService(Context bindContext, ServiceConnection conn)
Context#bindService(Intent, ServiceConnection, int)
call except it automatically
handles the intent and flags parameters.
This defines a dependency between your application and the ANT Radio Service. The given
conn will receive the service object when it is created and be told if it dies and restarts.
The ANT Radio Service will be considered required by the system only for as long as
bindContext exists. For example, if this Context is an Activity that is stopped, the
ANT Radio Service will not be required to continue running until the Activity is resumed.
This function will throw SecurityException
if you do not have permission to bind
to the ANT Radio Service.
bindContext
- The context used to perform the bindconn
- The service connection to receive the binderjava.lang.SecurityException
Context#unbindService(ServiceConnection)
public AntChannelProvider getChannelProvider() throws RemoteException
RemoteException
public AntAdapterProvider getAdapterProvider() throws RemoteException, UnsupportedFeatureException
RemoteException
UnsupportedFeatureException
- if feature is not supported by the
installed ANT Radio Service.public static int getVersionCode(Context context)
context
- The current context.SERVICE_VERSION_CODE_NOT_YET_KNOWN
. Otherwise,
it returns the version code of the ANT Radio Service, or if the
service package name does not exist in the android package info
returns SERVICE_VERSION_CODE_NOT_INSTALLED
.public static java.lang.String getVersionName(Context context)
context
- The current context.SERVICE_VERSION_NAME_NOT_YET_KNOWN
. Otherwise,
it returns the version name of the ANT Radio Service, or if the
service package name does not exist in the android package info
returns SERVICE_VERSION_NAME_NOT_INSTALLED
.public static void displayAntSettings(Context context)
context
- The current contextActivityNotFoundException
- on Android devices that do not have
the ANT Android system settings built in to their firmwareCopyright © 2015 Dynastream Innovations Inc. All Rights Reserved.