MobiWeb Help

Sharing (Android)

Bridge for opening Android's native share sheet from website JavaScript with support for text, URL, and file payloads.

Bridge object: AndroidShare

Method

Return

Description

AndroidShare.test()

string

Returns "AndroidShare bridge is accessible"

AndroidShare.canShare(payloadJson)

boolean

Returns whether a share target is available for the payload

AndroidShare.share(payloadJson)

string JSON

Returns {\"success\":true} on success, or {\"success\":false,\"error\":\"...\"}

Auto Shim for navigator.share

On Android, MobiWeb now auto-injects a shim that defines:

  • navigator.share(...) (if missing)

  • navigator.canShare(...) (if missing)

This lets websites that already use Web Share API trigger the native Android share sheet without website changes.

Payload Shape (Direct Bridge)

{ "title": "Receipt", "text": "Order #1234", "url": "https://example.com/orders/1234", "files": [ { "name": "receipt.pdf", "type": "application/pdf", "data": "<base64 or data-url-base64>" } ] }

Notes:

  • text and url are merged into the shared text body when both are present.

  • files[].data accepts either pure base64 or full data URL (data:...;base64,...).

  • Files are written to app cache and shared using FileProvider URIs.

Examples

Using navigator.share (recommended):

await navigator.share({ title: 'Order #1234', text: 'Receipt attached', files: [new File([blob], 'receipt.pdf', { type: 'application/pdf' })] });

Using direct bridge call:

const result = AndroidShare.share(JSON.stringify({ title: 'Hello', text: 'Shared from MobiWeb', url: 'https://example.com' })); console.log(result); // {"success":true}
03 May 2026