starti.app
How-to Guides

Share Content

Share text, URLs, and files through the native share sheet

Share Content

Use the native share sheet to share files, text, or download files to the device.

Prerequisites

  • The starti.app SDK is installed and initialized

Share a file

Share a file by providing its URL and a filename. This opens the native share sheet:

await startiapp.Share.shareFile("https://example.com/report.pdf", "report.pdf");

Share text

Share a text string through the native share sheet:

await startiapp.Share.shareText("Check out this app: https://example.com");

Download a file

Download a file directly to the device's download folder without showing the share sheet:

await startiapp.Share.downloadFile(
  "https://example.com/invoice.pdf",
  "invoice-2024.pdf",
);

Complete example

await startiapp.initialize();

// Share button
document.getElementById("share-btn").addEventListener("click", async () => {
  await startiapp.Share.shareText("Join me on this app!");
});

// Download button
document.getElementById("download-btn").addEventListener("click", async () => {
  await startiapp.Share.downloadFile(
    "https://api.example.com/export/data.csv",
    "export.csv",
  );
});

See also

On this page