API Reference
All available gametegra methods, organised by category.
App / SuperApp
| Method | Description |
|---|---|
| gametegra.getInfo | Retrieves the current user's profile information. |
| gametegra.getLanguage | Returns the app language and the device's system language. |
| gametegra.getLocation | Gets the device's current GPS location. |
| gametegra.camera | Opens the device camera and returns a base64-encoded JPEG image. |
| gametegra.getImage | Opens the device photo gallery for image selection. |
| gametegra.pay | Initiates a payment transaction for the given amount. |
| gametegra.getParams | Retrieves a launch parameter passed to the miniapp by key. |
| gametegra.openMiniApp | Opens another miniapp by its ID and returns the new session ID. |
| gametegra.searchMiniapps | Searches available miniapps by a text query. |
| gametegra.reportEvent | Reports a custom analytics event with arbitrary data. |
| gametegra.reportMiniApp | Submits a report or feedback about a user or the miniapp itself. |
| gametegra.callMethod | Calls a custom method exposed by the host app by name. |
| gametegra.startStream | Starts listening to a named event stream. Returns an Emitter to subscribe/unsubscribe. |
Lifecycle & UI
| Method | Description |
|---|---|
| gametegra.showLoading | Displays the host app's loading spinner. |
| gametegra.hideLoading | Hides the host app's loading spinner. |
| gametegra.vibrate | Triggers a haptic vibration on the device. |
| gametegra.getSafeAreaInsets | Returns the device's safe area insets (notch, home bar, etc.). |
| gametegra.close | Completely closes and unmounts the miniapp. |
| gametegra.sendToBackground | Minimizes the miniapp and sends it to the background without closing it. |
| gametegra.showMenu | Displays the miniapp's native menu overlay. |
| gametegra.setOrientation | Sets the screen orientation mode. |
| gametegra.onBackground | Registers a callback that fires when the miniapp is sent to the background. |
| gametegra.onForeground | Registers a callback that fires when the miniapp returns to the foreground. |
Game / SuperGame
| Method | Description |
|---|---|
| gametegra.createRoom | Creates a new multiplayer game room. |
| gametegra.joinRoom | Joins an existing game room by match ID. |
| gametegra.leaveRoom | Leaves the current game room. |
| gametegra.quickMatch | Initiates automatic matchmaking. |
| gametegra.getScore | Retrieves the current player's score. |
| gametegra.saveData | Saves a key-value pair to the player's persistent game storage. |
| gametegra.loadData | Loads stored data entries for the current player. |
| gametegra.showAd | Displays an advertisement. |
| gametegra.createLeaderboard | Creates a new leaderboard configuration. |
| gametegra.updateLeaderboard | Submits or updates the current player's score on a leaderboard. |
| gametegra.getLeaderboard | Fetches the top scores from a leaderboard. |
| gametegra.openMatchChat | Opens the native match chat UI. |
| gametegra.custom | Calls a custom backend game function by name. |
| gametegra.callGameMethod | Calls a game method by its key or mapped name. Useful when method names are overridden via setMethodMap. |
| gametegra.setMethodMap | Overrides the default backend method names with custom names. |
Stream / Real-time
| Method | Description |
|---|---|
| gametegra.sendData | Sends data over the active game stream. |
| gametegra.listenData | Starts listening to incoming game stream data. Returns an Emitter. |
| gametegra.connectGame | Connects to a named game stream and returns an Emitter for real-time events. |
| gametegra.stopStream | Stops an active stream by its channel key. |
| gametegra.getGyroscope | Starts streaming gyroscope sensor data from the device. |
| gametegra.getAccelerometer | Starts streaming accelerometer sensor data from the device. |
Chat
| Method | Description |
|---|---|
| gametegra.roomChat.join | Joins or creates a named room chat channel. Returns a handle for sending/receiving messages. |
| gametegra.roomChat.send | Sends a message to the chat room. Called on the handle returned by roomChat.join(). |
| gametegra.roomChat.getHistory | Retrieves past messages from the chat room. Called on the handle returned by roomChat.join(). |
| gametegra.roomChat.on | Registers an event listener on the chat handle. Supported events: message, presence, error, end. Called on the handle returned by roomChat.join(). |
| gametegra.roomChat.leave | Leaves the chat room and cleans up all event listeners. Called on the handle returned by roomChat.join(). |
Controls (JS/Web only)
| Method | Description |
|---|---|
| gametegra.controls.show | Renders the virtual gamepad overlay on screen. |
| gametegra.controls.hide | Hides the virtual gamepad overlay without destroying it. |
| gametegra.controls.on | Registers a listener for a specific control input event. |
| gametegra.controls.onAny | Registers a listener for all control input events. |
| gametegra.controls.destroy | Completely destroys the controls — removes DOM elements, CSS, and all event listeners. |
Dev Console (JS/Web only)
| Method | Description |
|---|---|
| gametegra.devConsole.show | Shows the developer console overlay. Optionally intercepts native console output. |
| gametegra.devConsole.log | Prints a message to the dev console overlay. |
| gametegra.devConsole.hide | Hides the console panel. The toggle button remains visible so the panel can be reopened. |
| gametegra.devConsole.toggle | Toggles panel visibility — hides if open, shows if hidden. |
| gametegra.devConsole.warn | Adds a warning-level log entry to the dev console panel. |
| gametegra.devConsole.error | Adds an error-level log entry to the dev console panel. |
| gametegra.devConsole.success | Adds a success-level log entry to the dev console panel. |
| gametegra.devConsole.clear | Clears all log entries from the dev console panel. |