Desktop shortcut

Using a native dialog box, you can offer the user to add a shortcut to the desktop — a link to the 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 device, internal browser rules, and Yandex Games platform restrictions.

To verify that the shortcut can be added, use the ysdk.shortcut.canShowPrompt() method:

1const ysdk = await YaGames.init();
2
3const prompt = await ysdk.shortcut.canShowPrompt();
4
5if (prompt.canShow) {
6  // Here you can show the button for adding the shortcut.
7}

Opening a dialog box

After checking, you can show a button (or another UI element) in the game that will open a dialog box for adding a shortcut when clicked.

To call the dialog, use the ysdk.shortcut.showPrompt() method:

1const ysdk = await YaGames.init();
2
3const result = await ysdk.shortcut.showPrompt();
4
5if (result.outcome === 'accepted') {
6  // Here you can grant a reward for adding the shortcut.
7}

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 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