Skip to content

platform

Sergei edited this page May 7, 2026 · 1 revision

Platform

The Platform module exposes host-platform data and lets the game report lifecycle events back to the host.

When to use

Every game uses Platform. You'll typically need at least:

  • platform.language — to localize text (read once after init).
  • platform.sendMessage('game_ready') — to dismiss the platform loader (call once when the game is fully loaded and playable).

Implementation order

  1. Required — Read platform.language and apply localization.
  2. Required — Send platform.sendMessage('game_ready') when the first playable frame is ready.
  3. Required — React to audio and pause state events to mute or pause the game when the user switches tabs or the platform requests it.
  4. Recommended — Send additional sendMessage lifecycle events (level_started, level_completed, etc.).

Language

Returns the language selected by the user on the host platform. If the platform does not provide a language, Bridge falls back to the browser language.

Bridge.platform.language

If the platform provides user language data, this will be the language set by the user on the platform. If not, it will be the browser language.

Format: ISO 639-1. Example: ru, en.

Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

Sending a Message to the Platform

Send lifecycle messages to the host platform. game_ready is required; the other messages help the platform understand gameplay state.

Bridge.platform.SendMessage(PlatformMessage.GameReady)
Message Parameters Description
game_ready No parameters The game has loaded, all loading screens have passed, the player can interact with the game.
in_game_loading_started No parameters Any loading within the game has started. For example, when a level is loading.
in_game_loading_stopped No parameters In-game loading has finished.
player_got_achievement No parameters The player reached a significant moment. For example, defeating a boss, setting a record, etc.
level_started optional "world" and "level", example:
{"world":"desert","level":"1"}
Gameplay has started. For example, the player has entered a level from the main menu.
level_completed optional "world" and "level", example:
{"world":"desert","level":"1"}
Gameplay has completed. For example, the player won level.
level_failed optional "world" and "level", example:
{"world":"desert","level":"1"}
Gameplay has failed. For example, the player lost level.
level_paused optional "world" and "level", example:
{"world":"desert","level":"1"}
Gameplay has paused. Opened settings menu or used pause button
level_resumed optional "world" and "level", example:
{"world":"desert","level":"1"}
Gameplay has resumed. Returned from settings menu or hit unpause button
Platform support · varies by message

The matrix below lists, for each message, the platforms whose host SDK receives a corresponding signal. On any other platform the call is a silent no-op.

Message Platforms that relay the message
game_ready dlightek, facebook, gamesnacks, playdeck, playgama, poki, portal, telegram, tiktok, xiaomi, yandex, youtube
in_game_loading_started crazy_games
in_game_loading_stopped crazy_games
level_started crazy_games, poki, yandex
level_completed crazy_games, gamesnacks, poki, yandex
level_failed crazy_games, gamesnacks, playdeck, poki, yandex
level_paused crazy_games, poki, yandex
level_resumed crazy_games, poki, yandex
player_got_achievement crazy_games

Does not relay any message: absolute_games, bitquest, discord, game_distribution, gamepush, huawei, jio_games, lagged, microsoft_store, msn, ok, reddit, samsung, vk, y8

Is Audio Enabled

Returns whether the host platform currently allows game audio. Mute immediately when this value is false and listen for changes.

Bridge.platform.isAudioEnabled
// Listen for state changes
private void Start()
{
    Bridge.platform.audioStateChanged += OnAudioStateChanged;
}

private void OnAudioStateChanged(bool isEnabled)
{
    // audio state changed
}
Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

Pause

Listen for host pause/resume requests. Pause gameplay, timers, and audio while isPaused is true.

// Listen for state changes
private void Start()
{
    Bridge.platform.pauseStateChanged += OnPauseStateChanged;
}

private void OnPauseStateChanged(bool isPaused)
{
    // pause state changed
}
Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

Platform ID

Use this value only for platform-specific branches, such as passing platform-only options or handling different promotion APIs.

Bridge.platform.id

Returns the ID of the platform on which the game is currently running.

Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

URL Parameter

Read optional launch data passed through the platform URL. Use it for referral codes, deep links, invited-user context, or other launch parameters.

Bridge.platform.payload

The exact URL format is platform-specific:

Platform URL Format
VK http://vk.com/game\_id**#your-info**
Yandex http://yandex.com/games/app/game\_id**?payload=your-info**
Crazy Games crazygames.com/game/game_name?payload=your-info
Mock site.com/game_name?payload=your-info
Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

Server Time

Returns trusted UTC server time. Use it for daily rewards, cooldowns, or time-limited offers where local device time is not reliable.

private void Start()
{
    Bridge.platform.GetServerTime(OnGetServerTimeCompleted);
}

private void OnGetServerTimeCompleted(DateTime? result)
{
    if (result.HasValue)
    {
        Debug.Log(result.Value); // UTC time
    }
}
Platform support · all 28 platforms

Supports: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, yandex, youtube

Native SDK

Returns the original platform SDK object when Bridge exposes it. Use it only for platform-specific features that Bridge does not wrap.

Domain Information

Returns the platform top-level domain when the host provides it. Use it for regional links, legal text, or domain-specific configuration.

Bridge.platform.tld

Returns null when no data is available; otherwise returns a TLD such as com or ru.

Platform support · 1 of 28 platforms

Supports: yandex

Does not support: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, youtube

Is Get All Games Supported

Check this flag before showing a "More games" button that depends on getAllGames. The same support set covers getAllGames(), isGetGameByIdSupported, and getGameById() below — all four are Yandex-only today.

Bridge.platform.isGetAllGamesSupported
Platform support · 1 of 28 platforms

Supports: yandex

Does not support: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, youtube

Get All Games

Returns platform-approved links to the developer's other games. Use it for a "More games" screen when the current platform supports cross-promotion.

private void Start()
{
    Bridge.platform.GetAllGames((success, games) => {
        Debug.Log($"OnGetAllGamesCompleted, success: {success}, games:");

        if (success) {
            switch (Bridge.platform.id)
            {
                case "yandex":
                    foreach (var game in games) {
                        Debug.Log($"App ID: {game["appID"]}");
                        Debug.Log($"Title: {game["title"]}");
                        Debug.Log($"URL: {game["url"]}");
                        Debug.Log($"Cover URL: {game["coverURL"]}");
                        Debug.Log($"Icon URL: {game["iconURL"]}");
                    }
                    break;
            }
        }
    });
}
Platform support · 1 of 28 platforms

Supports: yandex

Does not support: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, youtube

Is Get Game By Id Supported

Check this flag before showing UI that links to a specific game through getGameById.

Bridge.platform.isGetGameByIdSupported
Platform support · 1 of 28 platforms

Supports: yandex

Does not support: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, youtube

Get Game By Id

Returns the platform-approved link and metadata for one game. Use it when you need to promote a specific title instead of a full list.

private void Start()
{
    var options = new Dictionary<string, object>();

    switch (Bridge.platform.id)
    {
        case "yandex":
            options.Add("gameId", "111111");
            break;
    }

    Bridge.platform.GetGameById(options, (success, game) => {
        Debug.Log($"OnGetGameByIdCompleted, success: {success}, game:");

        if (success) {
            switch (Bridge.platform.id)
            {
                case "yandex":
                    Debug.Log($"App ID: {game["appID"]}");
                    Debug.Log($"Title: {game["title"]}");
                    Debug.Log($"URL: {game["url"]}");
                    Debug.Log($"Cover URL: {game["coverURL"]}");
                    Debug.Log($"Icon URL: {game["iconURL"]}");
                    Debug.Log($"Is Available: {game["isAvailable"]}");
                    break;
            }
        }
    });
}    
Platform support · 1 of 28 platforms

Supports: yandex

Does not support: absolute_games, bitquest, crazy_games, discord, dlightek, facebook, game_distribution, gamepush, gamesnacks, huawei, jio_games, lagged, microsoft_store, msn, ok, playdeck, playgama, poki, portal, reddit, samsung, telegram, tiktok, vk, xiaomi, y8, youtube

Clone this wiki locally