Functions

Catalyst Serverless Functions enable you to build custom functionalities in your application, automate tasks, or integrate with third-party services. You can develop functions for your Android app from the Catalyst console or the CLI.

Note: You can create six types of functions in Catalyst: Basic I/O, Advanced I/O, Cron, Event, Integration, and Browser Logic functions. However, you can only execute Basic I/O functions in Catalyst Android SDK.

Create a Function Instance

You can create an instance of a Catalyst function using the getFunctionInstance() method, and enable the methods defined in this class to access the instance object. This will prevent unnecessary server calls.

You can create a function instance in any of the following ways:

Create a Function Instance by passing the Function ID

You can pass the function’s unique Function ID as an argument to the getFunctionInstance() method and create an instance for it:

    
copy
ZCatalystApp.getInstance().getFunctionInstance( id: Long ): ZCatalystFunction

Parameters:

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getFunctionInstance(2823000000011091) //Replace this with your Function ID

Create a Function Instance by passing the API name of the function

You can pass the function’s API name as an argument to the getFunctionInstance() method and create an instance for it:

    
copy
ZCatalystApp.getInstance().getFunctionInstance( apiName: String ): ZCatalystFunction

Parameters:

  • apiName: The name of the function configured in Catalyst

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getFunctionInstance("LocalBackup") //Replace this with your function name

Last Updated 2023-09-03 01:06:41 +0530 +0530