Skip to content

Shortcut (Cocos)

Some channels (web browsers in particular) can offer to create a home‑screen shortcut / PWA install for the game. Most other channels can’t, so gate your UI first.

if (await FRVRSDK.instance.canCreateShortcut()) {
  showAddToHomeScreenButton();
}

Don’t show an “add to home screen” button unless this is true — it’ll do nothing on channels that don’t support it.

await FRVRSDK.instance.createShortcut();

Must be called from a user gesture (button tap) on browsers. Calling from a timer or a scene‑start hook won’t trigger the install prompt.

async onAddToHomePressed() {
  try {
    await FRVRSDK.instance.createShortcut();
    this.toast('Added to home screen!');
  } catch (err) {
    // user dismissed the install prompt, or the channel declined
  }
}
  • Platform‑specific behavior (PWA install vs. Android WebAPK vs. channel sheet): Web SDK shortcut.