Skip to Content
defold-typescript libraries
defold (official)

defold/extension-firebase/firebase

Functions and constants for interacting with Firebase

  • GitHub: defold/extension-firebase — pinned to 2.3.1 (released while Defold 1.13.1 was current)
    1. Pick a release from defold/extension-firebase releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as firebase from "firebase"

Functions

firebase.initialize(options?: table)

Initialize Firebase.

Parameters

  • options?: table — Optional table with initialization parameters to use instead of those specified in google-services.xml/plist. When passing this, disable creation of the default Firebase App by specifying firebase.no_auto_init in game.project. Valid keys in the table are api_key, app_id, database_url, messaging_sender_id, project_id, storage_bucket. All values are strings.

firebase.get_installation_auth_token()

Get the Firebase Installation auth token

firebase.set_callback(callback?: function)

Sets a callback function for receiving events from the SDK. Call firebase.set_callback(nil) to remove callback

Parameters

  • callback?: function — Callback function that is executed on any event in the SDK, or nil to remove the current callback.
    • self: object — The calling script instance
    • message_id: number — One of message types: firebase.MSG_INITIALIZED firebase.MSG_INSTALLATION_AUTH_TOKEN firebase.MSG_INSTALLATION_ID firebase.MSG_ERROR
    • message: table — A table holding the data
      • token?: string — for MSG_INSTALLATION_AUTH_TOKEN
      • id?: string — for MSG_INSTALLATION_ID
      • error?: string — The error message (if an error occurred or nil otherwise)

firebase.get_installation_id()

Get the Firebase Installation id

Constants

firebase.MSG_ERROR

firebase.MSG_INITIALIZED

firebase.MSG_INSTALLATION_AUTH_TOKEN

firebase.MSG_INSTALLATION_ID

On this page