
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.
DOCUMENTATION | GET PREMIUM PLUGINS | ISSUES
- Plugin Architecture: Extend app functionality with self-registering plugins. See the
PluginInterface.java
,PluginManager.java
, and existing plugins in/plugins/
for details. - File Uploads & Camera Access: Support for file selection and direct camera capture in WebView.
- Push Notifications: Integrated Firebase Cloud Messaging (requires
google-services.json
). - Google Analytics: Built-in support (configure GTAG ID in
SmartWebView.java
). - Custom UI Modes: Fullscreen and drawer layouts (configurable in
SmartWebView.java
). - Location & Permissions: Access device GPS/location and manage permissions.
- Content Sharing: Receive and handle shared content from other apps via
ShareActivity.java
. - Downloads & Printing: Handle file downloads and print web content.
- Modern WebView: Secure, up-to-date, and highly configurable via
SmartWebView.java
andMainActivity.java
.
Smart WebView features a plugin system to add new features with minimal effort.
-
Understanding Plugins:
- The core contract is defined in
PluginInterface.java
. - Plugin lifecycle and registration are managed by
PluginManager.java
. - Example plugins (
ToastPlugin.java
,JSInterfacePlugin.java
) are located in/plugins/
. These serve as excellent references for creating new plugins.
- The core contract is defined in
-
Testing Plugins:
Playground.java
is used to configure, test, and demonstrate plugin functionality during development.
-
Premium Plugins ⭐: List of premium plugins for Project Sponsors.
- ✅ AdMob: Integrate Google AdMob into your app; Includes Banner, Interstitial and Rewarded ad units.
- ✅ Biometric Auth: Enable fingerprint or face authentication for overall app or trigger on demand with JavaScript.
- ✅ QR & Barcode Reader: Scan QR codes and barcodes directly from your app.
- ✅ Image Compression: Compress images before uploading for better performance.
- ✅ JS Interface: Allows JavaScript code to call native methods and receive callbacks.
- 🚧 Google Auth: Add Google authentication for seamless sign-in.
- 🚧 Payment Gateway: Integrate payment solutions for in-app purchases.
- 🚧 Enhanced Video Player: Handle requests for fullscreen video playback (e.g., from YouTube or Vimeo embeds).
- 🚧 CSS Injection: Dynamically inject custom CSS into your web pages.
- 🚧 WebRTC: Build rich, real-time communication features directly into your web app.
- 🚧 Local Network Access: Host app with local network (e.g., for a dev server or an enterprise intranet).
🚧 Currently in development; availability in final bundle is subject to change.
- Clone the repository:
git clone https://github.com/mgks/Android-SmartWebView.git
- Open in Android Studio:
File > Open > Select the project folder
- Add
google-services.json
:- 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 theapp/
directory.
- If you plan to use Firebase services (like FCM for push notifications), obtain your
- Build & Run:
Build > Clean Project
thenBuild > Rebuild Project
Most configuration is done within SmartWebView.java
:
- Main Application URL:
- Set
ASWV_APP_URL
to your web application's address. ASWV_OFFLINE_URL
(file:///android_asset/offline.html
) is used ifASWV_APP_URL
points to a local file or if no internet is detected (andASWP_OFFLINE
logic permits).
- Set
- Feature Toggles:
- Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the boolean
ASWP_*
variables.
- Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the boolean
- Permissions:
- Review and adjust permissions in
AndroidManifest.xml
based on the features you enable. For example,CAMERA
for camera uploads,ACCESS_FINE_LOCATION
for GPS.
- Review and adjust permissions in
- Plugin Configuration:
- Plugin behavior (like AdMob IDs or Biometric Auth on launch) is configured in
Playground.java
. This allows you to change settings without modifying the plugin source code itself.
- Plugin behavior (like AdMob IDs or Biometric Auth on launch) is configured in
The best way to understand the project in depth is to explore the source code:
SmartWebView.java
: Contains most global configurations and constants.MainActivity.java
: The main entry point, handles WebView setup, and integrates core features.Functions.java
: Utility functions used throughout the app.PluginInterface.java
,PluginManager.java
: Key components of the plugin architecture.Playground.java
: The central place for configuring and testing plugins.- The
plugins/
directory: Contains example and premium plugin implementations. - Inline comments throughout the code provide additional context.
- Found a bug or want to contribute? Open an issue or create a pull request.
- Support the project via GitHub Sponsors.
This project is licensed under the MIT License.
For new developers: Programming can be challenging at times, but with practice and persistence, you can develop the skills to create amazing things. The beauty of programming is that it empowers you to bring your ideas to life and create your own world. Keep exploring & experimenting, and all the best for your next project!