Android - Method Module Interface
note
To call a MethodModule
, a Tecton Caliper extension is required. Please refer to the
Caliper guides to get started.
The MethodModule
interface is used when you need to run logic natively without requiring
any UI elements. It also allows you to trigger a callback, returning data back to the
Tecton side.
Implementation
To implement a MethodModule
:
- Create a class and inherit from
ModuleMethod
. - Define a function to handle your desired logic.
- Once the operation is complete, trigger the
MethodModule.MethodModuleCallback
to return the result.
Sample MethodModule Implementation
class TestMethodModule(private val sdkUtils: SdkUtils): MethodModule {
fun testMethod(context: Context, data: String, callback: MethodModule.MethodModuleCallback) {
// Once you are done, trigger the callback and send back the data you want.
callback.returnValue(data)
}
}
Triggering From Tecton
To call your MethodModule
, follow the
Tecton - callModule guide.
Update Your settings.json
Ensure your settings.json
file in the root of the DevApp is updated to reflect your
module changes. Learn more in Configuring settings.json.