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)- Pick a release from defold/extension-firebase releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as firebase from "firebase"
- Pick a release from defold/extension-firebase releases and add its Source code (zip) URL (or a packaged
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 instancemessage_id:number— One of message types:firebase.MSG_INITIALIZEDfirebase.MSG_INSTALLATION_AUTH_TOKENfirebase.MSG_INSTALLATION_IDfirebase.MSG_ERRORmessage:table— A table holding the datatoken?:string— for MSG_INSTALLATION_AUTH_TOKENid?:string— for MSG_INSTALLATION_IDerror?:string— The error message (if an error occurred ornilotherwise)
firebase.get_installation_id()
Get the Firebase Installation id