WebViewGold Documentation · Android
🇺🇸 English
Get WebViewGold

ShareIntent API

Receive content shared from other Android apps directly in your WebView app via Share Intents.

The WebViewGold ShareIntent API enables your app to appear as a target in Android’s native Share dialog. This allows users to share content such as text, URLs, or images (as base64 strings) from any other app directly into your WebView-based app.

Use Cases:

  • Sharing links to user profiles, notes, or articles directly into your app
  • Receiving content from messaging or browser apps
  • Sending images from the gallery to your WebView interface (base64-encoded)

Step 1: Enable Sharing Support in AndroidManifest.xml

To allow your app to receive shared data, uncomment the relevant intent filters in your AndroidManifest.xml file:

<!-- Receive shared text (e.g., URLs or notes) -->
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
</intent-filter>

<!-- Receive a single shared image -->
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>

<!-- Receive multiple shared images -->
<intent-filter>
    <action android:name="android.intent.action.SEND_MULTIPLE" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>

Once these filters are active, your WebViewGold-based app icon will appear as a sharing target whenever users share content from another app.

Step 2: Handle Shared Data in Your WebView

When a user shares content to your app, WebViewGold will automatically inject the shared content into a JavaScript variable named sharedData.

<script>
    alert(sharedData); // Displays the shared content (text or base64 image)
</script>
  • Text or URL: Will be passed as plain text into sharedData
  • Image: Will be converted to a base64-encoded string and passed into sharedData

Example Use: Automatically populate a form or preview an image based on the received content:

<script>
    if (sharedData) {
        document.getElementById("myInput").value = sharedData;
    }
</script>

Note: Ensure that your JavaScript is ready to handle both plain text and long base64 strings. You may also implement client-side checks to distinguish between different content types.

SDK-style implementation notes

Treat this feature as a native capability exposed to your web layer: keep your production website or PWA as the source of truth, then use the documented WebViewGold configuration flags, URL commands, and JavaScript bridge calls to opt in to native Android behavior only where it adds value. This approach keeps your codebase maintainable because the same web application can serve browsers, WebViewGold for Android, and the other WebViewGold platforms with minimal conditional logic.

For reliable results, prefer HTTPS endpoints, stable route names, explicit success/error states in your UI, and small JavaScript helper functions that wrap native calls. For example, a web app built with jQuery Mobile, Lovable, Base44, Bolt, WordPress, Bubble, a custom React/Vue/Angular stack, or static HTML can expose a single button or event handler that triggers the native WebViewGold API while still showing a graceful browser fallback.

  • Recommended integration pattern: detect the app context, call the WebViewGold API, then update your web UI after the native callback or route change.
  • Testing checklist: validate the feature on a real device or packaged build, verify permissions and store review text, and confirm that browser-only users still receive a useful fallback.
  • SEO benefit: keep feature pages, route titles, and structured content indexable on your website while WebViewGold delivers the native app shell for Android users.

Too busy? We set up your app for you.

Our team configures, builds & submits your WebViewGold app — done-for-you, fast turnaround, Made in Germany.

Get your app set up →

Build in your browser

No Mac, no IDE: the WebViewGold Cloud Builder configures, builds & uploads your app online.

Discover Cloud Builder →