|
1 | 1 | <!-- |
2 | | - Smart WebView 7.0 |
| 2 | + Smart WebView v7 |
| 3 | + https://github.com/mgks/Android-SmartWebView |
3 | 4 |
|
4 | | - MIT License (https://opensource.org/licenses/MIT) |
| 5 | + A modern, open-source WebView wrapper for building advanced hybrid Android apps. |
| 6 | + Native features, modular plugins, and full customisation—built for developers. |
5 | 7 |
|
6 | | - Smart WebView is an Open Source project that integrates native features into |
7 | | - WebView to help create advanced hybrid applications (https://github.com/mgks/Android-SmartWebView). |
| 8 | + - Documentation: https://docs.mgks.dev/smart-webview |
| 9 | + - Plugins: https://docs.mgks.dev/smart-webview/plugins |
| 10 | + - Discussions: https://github.com/mgks/Android-SmartWebView/discussions |
| 11 | + - Sponsor the Project: https://github.com/sponsors/mgks |
8 | 12 |
|
9 | | - Explore plugins and enhanced capabilities: (https://docs.mgks.dev/smart-webview/plugins) |
10 | | - Join the discussion: (https://github.com/mgks/Android-SmartWebView/discussions) |
11 | | - Support Smart WebView: (https://github.com/sponsors/mgks) |
| 13 | + MIT License — https://opensource.org/licenses/MIT |
12 | 14 |
|
13 | | - Your support and acknowledgment of the project's source are greatly appreciated. |
14 | | - Giving credit to developers encourages them to create better projects. |
| 15 | + Mentioning Smart WebView in your project helps others find it and keeps the dev loop alive. |
15 | 16 | --> |
16 | 17 |
|
17 | 18 | # Android Smart WebView |
|
21 | 22 | </a> |
22 | 23 |
|
23 | 24 | <p> |
24 | | - <a href="#features"><img alt="Variant" src="https://img.shields.io/badge/language-java-red.svg"></a> |
25 | | - <a href="https://github.com/mgks/Android-SmartWebView/releases"><img alt="Version" src="https://img.shields.io/badge/version-7.0-green.svg"></a> |
26 | | - <a href="https://github.com/mgks/Android-SmartWebView/blob/master/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg"></a> |
| 25 | + <a href="#features"><img alt="Variant" src="https://img.shields.io/badge/language-Java-red.svg"></a> |
| 26 | + <a href="https://github.com/mgks/Android-SmartWebView/releases"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/mgks/android-smartwebview"></a> |
| 27 | + <a href="https://github.com/mgks/Android-SmartWebView/blob/master/LICENSE"><img alt="GitHub License" src="https://img.shields.io/github/license/mgks/android-smartwebview"></a> |
27 | 28 | </p> |
28 | 29 |
|
29 | | -**Android Smart WebView** is a modern, open-source solution for building advanced hybrid Android apps. Effortlessly extend your app with plugins, native features, and a customizable UI. Whether you're a hobbyist or a professional, Smart WebView helps you bring your web content to life on Android with ease and flexibility. |
30 | | - |
31 | | -## Features |
32 | | - |
33 | | -- **Plugin Architecture:** Easily extend app functionality with self-registering plugins. |
34 | | -- **File Uploads & Camera Access:** Support for file selection and direct camera capture in WebView. |
35 | | -- **Push Notifications:** Integrated Firebase Cloud Messaging. |
36 | | -- **Google Analytics:** Built-in analytics support. |
37 | | -- **Custom UI Modes:** Fullscreen and drawer layouts. |
38 | | -- **Location & Permissions:** Access device GPS/location and manage permissions. |
39 | | -- **Content Sharing:** Receive and handle shared content from other apps. |
40 | | -- **Downloads & Printing:** Handle file downloads and print web content. |
41 | | -- **Modern WebView:** Secure, up-to-date, and highly configurable. |
42 | | - |
43 | | -## Plugin Support (v7.1+) |
44 | | - |
45 | | -Smart WebView now supports a powerful plugin system, allowing you to add new features and integrations with minimal effort. Plugins can be enabled, disabled, or customized to fit your app's needs. Here are some of the available plugins: |
46 | | - |
47 | | -- [**Plugin Architecture**](https://docs.mgks.dev/smart-webview/plugins): Learn how the plugin system works and how to integrate plugins. |
48 | | -- [**Creating Plugins**](https://docs.mgks.dev/smart-webview/plugins/creating-plugins): Guide to building your own custom plugins. |
49 | | -- [**Playground**](https://docs.mgks.dev/smart-webview/plugins/playground): Test and experiment with plugins in a sandboxed environment. |
50 | | -- [**Toast**](https://docs.mgks.dev/smart-webview/plugins/toast): Show native Android toast messages from your web content. |
51 | | -- [**Admob**](https://docs.mgks.dev/smart-webview/plugins/admob): Integrate Google AdMob ads into your app. |
52 | | -- [**Google Auth**](https://docs.mgks.dev/smart-webview/plugins/google-auth): Add Google authentication for seamless sign-in. |
53 | | -- [**QR & Barcode Reader**](https://docs.mgks.dev/smart-webview/plugins/qr-barcode-reader): Scan QR codes and barcodes directly from your app. |
54 | | -- [**Biometric Auth**](https://docs.mgks.dev/smart-webview/plugins/biometric-auth): Enable fingerprint or face authentication. |
55 | | -- [**Image Compression**](https://docs.mgks.dev/smart-webview/plugins/image-compression): Compress images before uploading for better performance. |
56 | | -- [**CSS Injection**](https://docs.mgks.dev/smart-webview/plugins/css-injection): Dynamically inject custom CSS into your web pages. |
57 | | -- [**Payment Gateway**](https://docs.mgks.dev/smart-webview/plugins/payment-gateway): Integrate payment solutions for in-app purchases. |
58 | | - |
59 | | -You can find more details and usage examples in the [Plugin Documentation](https://docs.mgks.dev/smart-webview/plugins). |
| 30 | +**Android Smart WebView** is a modern, open-source solution for building advanced hybrid Android apps. It allows you to effortlessly extend your app with plugins, native features, and a customizable UI. |
| 31 | + |
| 32 | +**[DOCUMENTATION](https://docs.mgks.dev/smart-webview/)** | **[GET PLUGINS](https://github.com/sponsors/mgks)** | **[ISSUES](https://github.com/mgks/Android-SmartWebView/issues)** |
| 33 | + |
| 34 | +## Core Features |
| 35 | + |
| 36 | +* **Plugin Architecture:** Extend app functionality with self-registering plugins. See the `PluginInterface.java`, `PluginManager.java`, and existing plugins in `/plugins/` for details. |
| 37 | +* **File Uploads & Camera Access:** Support for file selection and direct camera capture in WebView. |
| 38 | +* **Push Notifications:** Integrated Firebase Cloud Messaging (requires `google-services.json`). |
| 39 | +* **Google Analytics:** Built-in support (configure GTAG ID in `SmartWebView.java`). |
| 40 | +* **Custom UI Modes:** Fullscreen and drawer layouts (configurable in `SmartWebView.java`). |
| 41 | +* **Location & Permissions:** Access device GPS/location and manage permissions. |
| 42 | +* **Content Sharing:** Receive and handle shared content from other apps via `ShareActivity.java`. |
| 43 | +* **Downloads & Printing:** Handle file downloads and print web content. |
| 44 | +* **Modern WebView:** Secure, up-to-date, and highly configurable via `SmartWebView.java` and `MainActivity.java`. |
| 45 | + |
| 46 | +## Plugin System (v7.1+) |
| 47 | + |
| 48 | +Smart WebView features a plugin system to add new features with minimal effort. |
| 49 | +* **Understanding Plugins:** |
| 50 | + * The core contract is defined in `PluginInterface.java`. |
| 51 | + * Plugin lifecycle and registration are managed by `PluginManager.java`. |
| 52 | + * Example plugins (`AdMobPlugin.java`, `JSInterfacePlugin.java`, `ToastPlugin.java`) are located in `/plugins/`. These serve as excellent references for creating new plugins. |
| 53 | +* **Testing Plugins:** |
| 54 | + * `Playground.java` is used to configure, test, and demonstrate plugin functionality during development. |
| 55 | +* **Included Plugins:** The project includes an example plugin for Toasts. Plugins are designed to be self-registering. |
| 56 | +* **Premium Plugins:** List of premium plugins for **[Project Sponsors](https://github.com/sponsors/mgks)**. |
| 57 | + - [**Admob**](https://docs.mgks.dev/smart-webview/plugins/admob): Integrate Google AdMob ads into your app. |
| 58 | + - [**Google Auth**](https://docs.mgks.dev/smart-webview/plugins/google-auth): Add Google authentication for seamless sign-in. |
| 59 | + - [**QR & Barcode Reader**](https://docs.mgks.dev/smart-webview/plugins/qr-barcode-reader): Scan QR codes and barcodes directly from your app. |
| 60 | + - [**Biometric Auth**](https://docs.mgks.dev/smart-webview/plugins/biometric-auth): Enable fingerprint or face authentication. |
| 61 | + - [**Image Compression**](https://docs.mgks.dev/smart-webview/plugins/image-compression): Compress images before uploading for better performance. |
| 62 | + - [**CSS Injection**](https://docs.mgks.dev/smart-webview/plugins/css-injection): Dynamically inject custom CSS into your web pages. |
| 63 | + - [**Payment Gateway**](https://docs.mgks.dev/smart-webview/plugins/payment-gateway): Integrate payment solutions for in-app purchases. |
60 | 64 |
|
61 | 65 | ## Quick Start |
62 | 66 |
|
63 | | -1. **Clone the repository:** |
64 | | - ```sh |
65 | | - git clone https://github.com/mgks/Android-SmartWebView.git |
66 | | - ``` |
67 | | -2. **Open in Android Studio:** |
68 | | - - `File > Open > Select the project folder` |
69 | | -3. **Add your `google-services.json`** (if using Firebase services). |
70 | | -4. **Build & Run:** |
71 | | - - `Build > Clean Project` then `Build > Rebuild Project` |
| 67 | +1. **Clone the repository:** |
| 68 | + ```sh |
| 69 | + git clone https://github.com/mgks/Android-SmartWebView.git |
| 70 | + ``` |
| 71 | +2. **Open in Android Studio:** |
| 72 | + * `File > Open > Select the project folder` |
| 73 | +3. **Add `google-services.json`:** |
| 74 | + * If you plan to use Firebase services (like FCM for push notifications), obtain your `google-services.json` file from the Firebase console and place it in the `app/` directory. |
| 75 | +4. **Build & Run:** |
| 76 | + * `Build > Clean Project` then `Build > Rebuild Project` |
72 | 77 |
|
73 | 78 | ## Basic Configuration |
74 | 79 |
|
75 | | -- **Set Main URL:** |
76 | | - - Edit `ASWV_APP_URL` in `SmartWebView.java` to set your app's default web address. |
77 | | -- **Toggle Features:** |
78 | | - - Enable/disable features (file upload, camera, location, etc.) by setting the corresponding `ASWP_*` variables in `SmartWebView.java`. |
79 | | -- **Permissions:** |
80 | | - - Adjust required permissions in `AndroidManifest.xml` based on your app's needs (e.g., `INTERNET`, `CAMERA`, `LOCATION`). |
81 | | -- **Plugins:** |
82 | | - - Add or remove plugins in the `plugins/` directory and register them in your code. See [Plugin Architecture](https://docs.mgks.dev/smart-webview/plugins). |
83 | | - |
84 | | -## Documentation |
85 | | -- [Getting Started](https://docs.mgks.dev/smart-webview/) |
86 | | -- [Configuration](https://docs.mgks.dev/smart-webview/configuration) |
87 | | -- [Customization](https://docs.mgks.dev/smart-webview/customization) |
88 | | -- [Plugin Architecture](https://docs.mgks.dev/smart-webview/plugins) |
89 | | -- [Playground](https://docs.mgks.dev/smart-webview/plugins/playground) |
90 | | -- [FAQ & Troubleshooting](https://docs.mgks.dev/smart-webview/faq/) |
91 | | -- [Contributing](https://docs.mgks.dev/smart-webview/contributing) |
92 | | -- [License](https://docs.mgks.dev/smart-webview/license) |
| 80 | +Most configuration is done within `SmartWebView.java`: |
| 81 | + |
| 82 | +* **Main Application URL:** |
| 83 | + * Set `ASWV_APP_URL` to your web application's address. |
| 84 | + * `ASWV_OFFLINE_URL` (`file:///android_asset/offline.html`) is used if `ASWV_APP_URL` points to a local file or if no internet is detected (and `ASWP_OFFLINE` logic permits). |
| 85 | +* **Feature Toggles:** |
| 86 | + * Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the boolean `ASWP_*` variables. |
| 87 | +* **Permissions:** |
| 88 | + * Review and adjust permissions in `AndroidManifest.xml` based on the features you enable. For example, `CAMERA` for camera uploads, `ACCESS_FINE_LOCATION` for GPS. |
| 89 | +* **Adding/Modifying Plugins:** |
| 90 | + * Plugins are Java classes that implement `PluginInterface`. |
| 91 | + * They typically self-register with the `PluginManager` using a static block. |
| 92 | + * Refer to the existing plugins in the `/plugins/` directory for examples on how to create and integrate them. |
| 93 | +
|
| 94 | +## Further Information & Understanding the Code |
| 95 | +
|
| 96 | +The best way to understand the project in depth is to explore the source code: |
| 97 | +* **`SmartWebView.java`**: Contains most global configurations and constants. |
| 98 | +* **`MainActivity.java`**: The main entry point, handles WebView setup, and integrates core features. |
| 99 | +* **`Functions.java`**: Utility functions used throughout the app. |
| 100 | +* **`PluginInterface.java`, `PluginManager.java`, `Playground.java`**: Key components of the plugin architecture. |
| 101 | +* The `/plugins/` directory: Contains example plugin implementations. |
| 102 | +* Inline comments throughout the code provide additional context. |
93 | 103 |
|
94 | 104 | ## Contributing & Support |
95 | | -- Found a bug or want to contribute? [Open an issue](https://github.com/mgks/Android-SmartWebView/issues) or [create a pull request](https://github.com/mgks/Android-SmartWebView/pulls). |
96 | | -- Support the project via [GitHub Sponsors](https://github.com/sponsors/mgks). |
| 105 | +* Found a bug or want to contribute? [Open an issue](https://github.com/mgks/Android-SmartWebView/issues) or [create a pull request](https://github.com/mgks/Android-SmartWebView/pulls). |
| 106 | +* Support the project via [GitHub Sponsors](https://github.com/sponsors/mgks). |
97 | 107 |
|
98 | 108 | ## License |
99 | 109 | This project is licensed under the [MIT License](LICENSE). |
|
0 commit comments