Smart WebView can register as a target for the native sharing functionality, allowing users to share content (like URLs, text, images) directly to your application from other apps.


Enabling Sharing

Configuration:

Sharing is enabled via the `ShareActivity` declaration and its `` elements in `AndroidManifest.xml`. These filters specify the MIME types the app can receive (`text/*`, `image/*`). ```xml ``` ```md ```

Configuring the Target URL

Specify a URL endpoint within your web application where shared content should be processed.

Configure `ASWV_SHARE_URL` in `SmartWebView.java`. ```java // URL where shared content is processed. // Defaults to ASWV_URL with "?share=" appended. static String ASWV_SHARE_URL = ASWV_URL + "?share="; ``` ```md ```

How it Works

1. User shares content and selects your app. 2. Android launches `ShareActivity` based on the intent filter. 3. `ShareActivity` extracts data (`Intent.EXTRA_TEXT`, `Intent.EXTRA_STREAM`). 4. For text/links, it constructs a target URL using `ASWV_SHARE_URL` with `text` and `link` query parameters. 5. For images, the current implementation passes the URI as `s_img` (needs enhancement for practical use). 6. `ShareActivity` starts `MainActivity`, passing the target URL (`s_uri`) or image info (`s_img`). 7. `MainActivity` detects these extras in `onCreate` and loads the appropriate URL (or default URL for images currently). ```md ```

Processing on Your Website:

Your web application backend (at the target URL endpoint) needs to handle the incoming query parameters (e.g., text, link) or process data passed via other means (like image uploads triggered after sharing) to display or save the shared content appropriately.


Disabling Sharing

Remove or comment out the entire `...` block from `AndroidManifest.xml`. ```md ```