Platform

Platform manager

Get User's ID on the platform

If a player is logged in, getUserID returns the player's social ID. If the player is not logged in, a temporary ID is generated. Upon login, the temporary ID is replaced with a real one.

connector.platform.getUserID();

Platforms with native loading screens

  • Facebook Instant Games
  • Wortal
  • Samsung

Some platforms have their own loading screens, so you need to report your game's loading progress.

if (connector.platform.hasNativeLoadingScreen) {
  connector.platform.reportLoadingProgress(10);
  connector.platform.reportLoadingProgress(50);
  connector.platform.reportLoadingProgress(100);
}

Notify platforms when your game has loaded and ready to start

  • Samsung
  • Facebook Instant Games
  • Crazy Games
  • GameSnacks
  • YouTube
await connector.platform.startGame();

Notify platforms when your game is interactable

  • Yandex Games
  • YouTube
  • GameSnacks

On some platforms you need to also notify them when your game is fully interactable and playable.

connector.platform.notifyGameReady();

Pause

You have access to the pause control mechanism in the game. The SDK has a "Paused" flag, by itself it means nothing, however, you can engage in it if you need to pause and continue the game. Additionally, the SDK will notify you when a pause or resume has been triggered.

connector.platform.isPaused;

// Pause the game
connector.platform.pause();
// Resume the game
connector.platform.resume();

// Paused the game
connector.platform.on("pause", () => {});
// Resumed the game
connector.platform.on("resume", () => {});

Members

(static) isPaused :Boolean

Game pauses when page loses focus or app is minimized. You can also pause it with connector.platform.pause().

Type:
  • Boolean

(static) isAudioEnabled :Boolean

Indicates whether the platform can control inGame audio by disabling or enabling it.

Type:
  • Boolean

(static) hasAudioControls :Boolean

If the platform has a dedicated audio control switch, indicates whether audio is currently enabled

Type:
  • Boolean

(static) hasNativeLoadingScreen :Boolean

Whether the platform has its own loading screen, and you need to report your game's loading progress

Type:
  • Boolean

(static) enforceSuggestedLanguage :Boolean

Return true if the platform requires using the suggested languages

Type:
  • Boolean

Methods

(static) getUserID() → {string}

Returns userID

Returns:
Type: 
string

(static) pause()

Pauses the game

(static) resume()

Resume the game

(static) isTester()

Whether the player is a tester. Testers can be specified in config.testers

(static) openUrl()

Opens external url

(static) locationReload()

Reloads page

(static) listSuggestedLanguages() → {Array.<string>}

Returns list of suggested languages for the player.

Returns:
Type: 
Array.<string>

(static) reportLoadingProgress(percent)

Updates loading progress on platform loading screen.

Platforms: Samsung, Crazy, Instant.

Parameters:
NameTypeDescription
percentnumber

Loading progress

(static) startGame() → {Promise}

Needs to be called on some platforms when the game finished loading.

Returns:

Platforms: Samsung, Crazy, Instant, GameSnacks, YouTube.

Type: 
Promise

(static) getSafePadding() → {object}

Returns safe screen paddings e.g. { left: 20, right: 0, top: 50, bottom: 0}

Returns:
Type: 
object

(static) getFrameSize() → {object}

Returns window frame size e.g. { width: 1920, height: 1080}

Returns:
Type: 
object

(static) canReview() → {Boolean}

Whether review is available

Returns:
Type: 
Boolean

(static) requestReview() → {Promise.<Boolean>}

Show a dialog that suggests a user to rate the game

Returns:
Type: 
Promise.<Boolean>

(static) canCreateShortcut() → {Boolean}

Whether shortcut is available

Returns:
Type: 
Boolean

(static) createShortcut() → {Promise.<Boolean>}

Create shortcut on home screen or add game to favorites

Returns:
Type: 
Promise.<Boolean>

(static) notifyGameReady()

Needs to be called on some platforms when the game is ready and playable.

Platforms: Yandex, YouTube.

(static) gameplayStart()

Has to be called whenever the player starts playing or resumes playing after a break (menu/loading/achievement screen, game paused, etc.)

Platforms: Crazy.

(static) gameplayStop()

Has to be called on every game break (entering a menu, switching level, pausing the game, etc.)

Platforms: Crazy.

(static) listGames() → {Promise.<Array.<Platform.GameInfo>>}

Get as list with information about all your games published on this platform

Returns:

Platforms: Yandex.

Type: 
Promise.<Array.<Platform.GameInfo>>

Type Definitions

GameInfo

Properties
NameTypeDescription
appIDstring

Game's ID on this platform

imageURLstring

URL to the game's image

iconURLstring

URL to the game's icon

titlestring

The name of the game

linkstring

Link to the game