Shortcut on the desktop
Using the native dialog, you can offer the user to add a shortcut to the desktop — a link to the game.
Before displaying the dialog, make sure that the option is available.
Checking the ability to add a shortcut
The availability of the option depends on the platform, the browser's internal rules, and
the restrictions of the Yandex Games platform. To make sure
that you can add a shortcut, use the ysdk.shortcut.can_show_prompt()
method:
ysdk.shortcut.can_show_prompt(function (self, can_show)
if can_show then
-- Here you can show a button to add a shortcut
end
end)
Calling the dialog
After checking, you can show a button (or another interface element) in the game, which,
when pressed, will call the shortcut addition dialog. To call the dialog, use the
ysdk.shortcut.show_prompt()
method:
ysdk.shortcut.show_prompt(function (self, accepted)
if accepted then
-- Here you can reward the user for adding a shortcut
end
end)