Defold Inter-app communication API documentation

This extension provides functions for doing inter-app communication. Supported on iOS and Android.

Usage

To use this library in your Defold project, add the following URL to your game.project dependencies:

https://github.com/defold/extension-iac/archive/master.zip

We recommend using a link to a zip file of a specific release.

Source code

The source code is available on GitHub

API reference

Modules

iac

Functions and constants for doing inter-app communication. Supported on iOS and Android. [icon:ios] [icon:android]

Enums

iac.TYPE_INVOCATION

iac type


Functions

iac.set_listener() Sets the listener function for inter-app communication events.

iac.set_listener(self, payload, type)

Parameter Type Description
self object

The current object.

payload table

The iac payload.

type number

The type of iac, an iac.TYPE_ enumeration. It can be one of the predefined constants below

  • iac.TYPE_INVOCATION

Sets the listener function for inter-app communication events.

Examples

  local function iac_listener(self, payload, type)
       if type == iac.TYPE_INVOCATION then
           -- This was an invocation
           print(payload.origin) -- origin may be empty string if it could not be resolved
           print(payload.url)
       end
  end

  function init(self)
       iac.set_listener(iac_listener)
  end