Desktop shortcut

Using a native dialog box, you can offer the user to add a shortcut link to their desktop that leads to your game.

Before displaying the dialog box, make sure that the option is available.

Checking whether adding a shortcut is available

Whether the option is available depends on the platform, internal browser rules, and Yandex Games restrictions. To verify that the shortcut can be added, use the ysdk.shortcut.canShowPrompt() method:

YaGames.init().then(ysdk => ysdk.shortcut.canShowPrompt()).then(prompt => {
  console.log('Shortcut is allowed?:', prompt);
  if (prompt.canShow) {
    // Here you can show the button for adding a shortcut
  }
});

Opening a dialog box

After checking, you can show a button (or another UI element) in the game and make it call a dialog box for adding a shortcut when clicked. To call the dialog, use the ysdk.shortcut.showPrompt() method.

YaGames.init().then(ysdk => ysdk.shortcut.showPrompt()).then(result => {
  console.log('Shortcut created?:', result);
  if (result.outcome === 'accepted') {
    // Here you can grant a reward for adding a shortcut
  }
});

The first time the method is called, a shortcut is created for the Yandex Games catalog. If it already exists, a shortcut with a link to the game will be created.


Note

Our support team can help publish finished games or WebApps on Yandex Games. If you have any questions about development or testing, ask them in the Discord channel.

If you are facing an issue or have a question regarding the use of Yandex Games SDK, please contact support:

Write to chat