public final class SapaAppService
extends java.lang.Object
connect
method needs to be called when
you start using classdisconnect
method needs to be
called when you stop using this class
Every application can have only one instance of this class.Constructor and Description |
---|
SapaAppService(android.content.Context context)
Creates instance that is not connected to service.
|
Modifier and Type | Method and Description |
---|---|
SapaApp |
activateApp(SapaAppInfo info)
This method request a service to start instance of one application.
|
void |
addActiveApp(SapaAppInfo info)
This method notifies the service that the instance of application was
initialized.
|
void |
addAppStateListener(SapaAppStateListener listener)
Adds listener for changes in other applications.
|
void |
addConnectionListener(SapaServiceConnectListener listener)
Adds listener for the connection settlement.
|
void |
callAction(SapaApp sapaApp,
java.lang.String actionId)
This method request action call on another application.
|
void |
changeAppInfo(SapaAppInfo info)
Using this method, you can update your instance SapaAppInfo on the Audio
Connection Service so that it is available for other applications.
|
void |
connect()
This method connects this class to the Audio Connection Service.
|
void |
deactivateApp(SapaApp sapaApp)
This method requests deactivation of other application.
|
void |
declareTransportMaster()
This method is used to declare that your app is the transport master.
|
void |
disconnect()
This method disconnects this class from Audio Connection Service.
|
SapaAppInfo |
getActiveApp(SapaApp sapaApp)
This method gets information about the active instance of the application.
|
java.util.List<SapaAppInfo> |
getAllActiveApp()
This method returns a list of active instances of AudioApps.
|
java.util.List<SapaAppInfo> |
getAllInstalledApp()
This method returns a list of installed AudioApps.
|
SapaAppInfo |
getInstalledApp(java.lang.String packageName)
This method gets the information about installed application.
|
android.content.Intent |
getLaunchIntent(SapaApp sapaApp)
This method obtains configurations described in the info of other applications.
|
java.lang.String |
getTransportMaster()
Returns package name of transport master.
|
void |
removeActionDefiner()
Removes action definer.
|
void |
removeAppStateListener(SapaAppStateListener listener)
Remove listener for changes in other applications.
|
void |
removeConnectionListener(SapaServiceConnectListener listener)
Removes the listener for the connection settlement.
|
void |
removeFromActiveApps(SapaApp sapaApp)
This method removes application from the active list.
|
void |
setActionDefiner(SapaActionDefinerInterface actionDefiner)
Sets object defining actions of application.
|
public SapaAppService(android.content.Context context)
context
- Context of your application.public void addActiveApp(SapaAppInfo info) throws SapaConnectionNotSetException, java.security.InvalidParameterException
info
- SapaAppInfo instance representing application status, that means
with information about registered ports etc.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.java.security.InvalidParameterException
- Thrown when you try to use this method to activate other app.public void disconnect()
public void connect()
java.lang.UnsupportedOperationException
- Thrown when you already have bound to the service.java.lang.RuntimeException
- Throw when bind a service was failed.public void addConnectionListener(SapaServiceConnectListener listener)
listener
- Listener for the connection settled to be set.public void removeConnectionListener(SapaServiceConnectListener listener)
listener
- Listener for the connection settled to be remove.public void addAppStateListener(SapaAppStateListener listener)
listener
- Listener for changes in other applications.public void removeAppStateListener(SapaAppStateListener listener)
listener
- Listener for removes in other applications.public void changeAppInfo(SapaAppInfo info) throws SapaConnectionNotSetException
info
- SapaAppInfo of changed instance.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public void removeFromActiveApps(SapaApp sapaApp) throws SapaConnectionNotSetException
sapaApp
- sapaApp object from instance of applicationSapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public java.util.List<SapaAppInfo> getAllActiveApp() throws SapaConnectionNotSetException
SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public java.util.List<SapaAppInfo> getAllInstalledApp() throws SapaConnectionNotSetException
SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public SapaAppInfo getActiveApp(SapaApp sapaApp) throws SapaConnectionNotSetException
sapaApp
- sapaApp object from instance of applicationSapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public SapaAppInfo getInstalledApp(java.lang.String packageName) throws SapaConnectionNotSetException
packageName
- Package name of application which info we want to get.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public SapaApp activateApp(SapaAppInfo info) throws SapaConnectionNotSetException, java.security.InvalidParameterException
info
- SapaAppInfo instance representing application configuration, that
means with information about registered ports etc.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.java.security.InvalidParameterException
- Thrown when application cannot be added as there are too many
applications added. Normally, 8 instances per an application can be activated.public void deactivateApp(SapaApp sapaApp) throws SapaConnectionNotSetException, java.lang.IllegalAccessException
sapaApp
- SapaApp object from instance of application to be deactivated.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.java.lang.IllegalAccessException
- Thrown when application which is to be deactivated is not
responsive or not active.public void callAction(SapaApp sapaApp, java.lang.String actionId) throws SapaConnectionNotSetException, SapaUndeclaredActionException
sapaApp
- SapaApp object from instance of applicationactionId
- Identifier of action to be called.SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.SapaUndeclaredActionException
- This action was not declared by the instance.public void setActionDefiner(SapaActionDefinerInterface actionDefiner)
actionDefiner
- Object defining actions of application.public void removeActionDefiner()
public android.content.Intent getLaunchIntent(SapaApp sapaApp) throws SapaConnectionNotSetException, java.lang.IllegalAccessException
sapaApp
- SapaApp object from instance of applicationSapaConnectionNotSetException
- Thrown if connection was not set before calling this method.java.lang.IllegalAccessException
- Thrown when application which is to be deactivated is not
responsive or not active.public void declareTransportMaster() throws SapaConnectionNotSetException
SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.public java.lang.String getTransportMaster() throws SapaConnectionNotSetException
SapaConnectionNotSetException
- Thrown if connection was not set before calling this method.