Getting started
Download the APOLLO SDK
Please contact us with a brief description of your applications and contact information.
Using the .jar file
Put the com.spectratech.controllers-*.jar
into your project's app/libs
directory.
app/libs
├── ...
├── com.spectratech.controllers-0.02.0.jar
└── ...
In your project's app build.gradle, make sure to include:
dependencies {
...
implementation fileTree(dir: 'libs', include: ['*.jar'])
...
}
Initialization
We'll be showing kotlin example throughout the SDK section
getInstance
The SDK uses a singleton pattern, this is to ensure that there is only one instance is created. Use getControllerInstance(context, callbackDelegate)
to create instance. After it is done, use releaseControllerInstance()
to release it.
connectController
After getting the instance, the next thing is to establish the communication channel with the secure module. Use connectController()
& disconnectController()
to connect and disconnect respectively.
Once it is connected, you can start implementing specific functions to the dedicated object.
enableDebugLog
During development time, you can turn on the debug log by enableDebugLog(true)
. This allows all functions, callbacks and their input/ output printed in the console. This debug log is by default off.
Note that the log may contain sensitive data and hence this should be turned off in the release version.
onError
Errors may occur and it is returned by onError
callback.
Example for transactionFlowController
abstract class ApolloTransactionController(private val context: Context) : TransactionFlowDelegate {
private var transactionFlowController: TransactionFlowController? = null
fun connect() {
if (transactionFlowController == null) {
// get instance
transactionFlowController = getControllerInstance(context, this)
// enable debug log display in console
SPDeviceController.enableDebugLog(true)
// establish the communication channel with secure module
transactionFlowController?.connectController()
}
}
fun disconnect() {
transactionFlowController?.disconnectController()
transactionFlowController?.releaseControllerInstance()
}
override fun onError(errorType: ControllerError.Error?, message: String?) {
// handle error here
}
}