Releases: mgks/Android-SmartWebView
Android Smart WebView 7.1 🎉 (Plugins Release)
This is a landmark release for Smart WebView! Version 7.1 introduces a powerful and flexible plugin architecture, transforming Smart WebView from a simple web wrapper into an extensible foundation for building advanced hybrid applications.
This new system allows developers to add complex native features as modular, self-contained units without altering the core project code. This makes customization easier, updates cleaner, and opens the door for a new ecosystem of premium, high-value features.
✨ What's New: The Plugin Architecture
The core of this update is a new set of components designed for maximum extensibility:
🔌 Plugin Manager (PluginManager.java): A central hub that handles the registration, initialization, and lifecycle of all active plugins. It ensures that plugins have safe access to the app's context and WebView instance.
🧩 Standardized Interface (PluginInterface.java): A clear contract that all plugins must implement. It defines essential methods for initialization, event handling (onActivityResult, onRequestPermissionsResult), and WebView interaction (shouldOverrideUrlLoading, onPageFinished).
🚀 Self-Registration: Plugins are now self-registering. By simply including a plugin's source file in the project, its static initializer block automatically registers it with the PluginManager on app startup.
🧪 The Playground (Playground.java): A dedicated class for developers to test, configure, and debug plugins in a sandboxed environment. It includes fail-safe diagnostic tools and a method for injecting a demo UI into the WebView for easy manual testing.
⚙️ Centralized Configuration: Plugins can now be enabled or disabled globally (ASWP_PLUGINS) or individually via the ASWP_PLUGIN_SETTINGS map in SmartWebView.java. This allows for fine-grained control over which features are active.
Example Plugin Included
🍞 ToastPlugin: To demonstrate the new architecture and provide a template for developers, a simple ToastPlugin is included in the open-source project. It shows how to create a plugin, implement the interface, register it, and create a JavaScript bridge.
💎 Premium Plugins Now Available
This new architecture enables us to offer a suite of powerful, ready-to-use premium plugins for GitHub Sponsors. These are designed to drop into your project and work with minimal setup:
- AdMob: Easily integrate banner, interstitial, and rewarded video ads.
- Biometric Authentication: Secure your app with fingerprint or face unlock.
- QR/Barcode Scanner: Add in-app code scanning using the device camera.
- Image Compression: Automatically compress images before uploading to save bandwidth.
- JS Bridge: A more robust two-way communication bridge between native code and JavaScript.
🐛 Fixes & Improvements
This release also includes several important fixes and modernizations:
- [Fixed] File Upload Callback: Resolved a critical issue where the file chooser callback (
asw_file_path) could be lost, preventing file uploads from completing. The entire file handling logic has been modernized to use theActivityResultLauncher, making it more reliable and removing deprecatedstartActivityForResultcalls. - [Fixed] FCM Notification Clicks: Corrected an issue where tapping a notification might not properly open the specified URL. The intent handling for notifications is now more robust.
- [Fixed] Location Service Stability: Improved the GPS tracking logic in
GPSTrack.javato handle cases where a location provider is unavailable, preventing potential null pointer exceptions. - [Improved] Permission Handling: Refactored permission requests to be more streamlined and context-aware, especially for file and camera access on modern Android versions.
- [Improved] URL Handling: The logic for distinguishing internal vs. external URLs (
aswm_host) has been refined for better accuracy. - [Improved] Code Modernization: Updated various parts of the codebase to use modern Android practices, including stricter type checking, better error logging, and improved resource management. The project now targets Android 14 (SDK 35).
For Developers
- To create your own plugin, simply create a new class that implements
PluginInterfaceand add a static block for self-registration. SeeToastPlugin.javafor a complete example. - The
Playground.javaclass is the best place to start for testing your new plugins. Add your plugin to the diagnostic checks and the demo UI. - All plugins are disabled by default if the global
ASWP_PLUGINSflag is set tofalse. You can also toggle individual plugins in theASWP_PLUGIN_SETTINGSmap.
A massive thank you to our community and sponsors for making this evolution possible. We're excited to see what you build with the new plugin system.
Android Smart WebView 7.0 🎉 (Major Release)
Smart WebView v7.0 empowers developers to build even more dynamic and feature-rich hybrid applications. This release focuses on extensibility with a new plugin architecture, alongside improvements to core functionalities. Users will benefit from enhanced performance, streamlined file handling, and other capabilities. The update reflects a commitment to providing a versatile and efficient platform for app development.
Changelog
Major Features and Enhancements:
- Plugin Architecture:
- Introduced a new, self-contained plugin architecture enabling developers to extend Smart WebView's functionality without modifying core files.
- Plugins can register themselves and handle their own lifecycles, permissions, and activity results.
- File Uploads and Camera Access:
- Refactored file upload and camera access logic into a dedicated
FileProcessingclass for improved code organization. - Dynamically handles file MIME types based on HTML input
acceptattributes. - Enhanced error handling and user feedback during file selection and camera operations.
- Refactored file upload and camera access logic into a dedicated
- Firebase Cloud Messaging (FCM):
- Updated FCM implementation to use the latest Firebase SDK.
- Resolved issues with token retrieval and
onNewToken()not being called.
- Google Analytics (gtag.js):
- Dynamically injects the gtag.js script after page load to prevent interference with page loading and improve performance.
- Permissions:
- Refactored permission handling to request permissions on demand only when needed.
- Added support for granular media permissions and the
POST_NOTIFICATIONSpermission for Android 13 and above. - Implemented rationale dialogs for explaining permission requests to the user.
- Security:
- Enforced HTTPS by default and optional to disable certificate verification with alert toast in debug mode.
- Removed the deprecated
WRITE_EXTERNAL_STORAGEpermission, relying on Scoped Storage for file access.
Other Improvements and Updates:
- Modernized Codebase:
- Updated project to target Android 14 (API level 35) and use the latest AndroidX libraries.
- Adopted Java 17 source and target compatibility.
- Refactored code for better modularity, readability, and maintainability.
- Dependency Management:
- Updated all dependencies to their latest versions.
- Removed deprecated Firebase dependencies.
- Bug Fixes:
- Fixed an issue where the welcome screen would not disappear in certain scenarios.
- Resolved several issues related to file uploads and camera access.
- Addressed potential
NullPointerExceptionsrelated to context handling inFirebase.
- Code Cleanup:
- Removed unused code, variables, and functions.
- Improved comments and documentation.
API Changes:
PluginInterface: Introduced a newPluginInterfacewith methods for plugin initialization, event handling, and simplified interaction with the WebView.PluginManager: Added aPluginManagerclass to handle plugin registration, lifecycle events, and communication with plugins.FileProcessing: Added aFileProcessingclass to encapsulate file upload and camera access logic.Functions: Removed several methods related to printing, cookies, orientation, file access, permissions, ratings, FCM, and device info. These are either handled elsewhere or no longer needed.SmartWebView: Removed or modified several variables related to configuration, user agent, and permissions, and added variables related to debugging and Google Tag. Also, removedASWP_OFFLINElogic.MainActivity: Refactored to use thePluginManagerandFileProcessingclasses. ModifiedonShowFileChooser(),Callbackclass,shouldOverrideUrlLoading(),onPageFinished(),onRequestPermissionsResult()andonActivityResult(). Removed unused methods and variables related to permissions and other features now handled by plugins or other classes.Firebase: Refactored to improve context handling, remove unnecessary constructor, and simplify notification handling logic.
New Files:
MetaPull.java: Pulls device and SWV release details.FileProcessing.java: Handles file upload and camera access.PluginManager.java: Manages the plugin architecture.PluginInterface.java: Defines the interface for plugins.
Testing:
- Thoroughly test all features on a variety of devices and Android versions (especially API levels 23, 24, 29 and above) to ensure compatibility and proper functionality.
Migration from v6.x:
- Developers who have created custom features (now plugins) for Smart WebView v6.x can update their scripts to plugins to conform to the new
PluginInterfaceand register them using thePluginManager. - Any code that directly interacted with the removed methods or variables in
MainActivity,Functions, orSmartWebViewwill need to be updated to use the new plugin architecture or the appropriate classes (e.g.,FileProcessingandPluginManager).
Android Smart WebView 6.0 (p_0.2) (minor release)
Features Updated:
- Exit Dialog
- Manual Webpage Printing
Change Log:
- Target SDK: API 33 (Android 13)
- Gradle Version Update to 7.4.2
- File Upload Fixed
- Camera Rotation Fixed
- Other Minor Bug Fixes
Report your issues here.
If you liked the project and want to support, feel free to Sponsor me on GitHub :)
Android Smart WebView 5.0 (p_0.1)
This release comes with an interesting news for SWV project followers.
Android Smart WebView p_0.1 is part of the new pro merger channel.
So SWV Pro is now a part of SWV's Official Open Source Project; free for everyone to explore.
Let's talk about features included:
- Live GPS Location Tracking
- File Upload
- Camera Photo Processing
- Firebase Push Notifications
- Google AdMob
- Chromium Tab
- Handling Data Sharing
- Rating System
- Switch Navigation Interface w/ Drawer and Search Bar
- Action Menu
- Ability to add Official SWV Plugins
Change Log:
- Target SDK: API 29 (Android 10)
- New release channel
- Gradle plugin 3.5
- Gradle version 5.5
- Introducing new variable ASWV_EXC_LIST (not active till next release)
- Pullfresh bug fix
- Multi-file upload improvement/fix
- Other minor bug fixes
Report your issues here.
If you liked the project and want to support, feel free to Donate :)
Android Smart WebView 4.0
Android Smart WebView 4.0 comes with certain major changes that will change the course of whole project in coming future. Android support libraries are now replaced with Androidx, Min. SDK requirement changed from 19+ to 21+ and target from 28 to 29 (Android Q).
UPDATE: Few months back I developed SWV Pro to help this repo keep updated with some additional features; but it's tough for me to keep two different variants from same project updated. So I've decided to merger two once 15 copies sold. I hope to get support from you guys making this project better, we've already come so far.
Let's make the best webview there is :)
Update Log:
- Android support library removed to implement Androidx
- Gradle updated
- Min. SDK changed to 21+
- Target version is API 29 (Android Q) now
- No connection/Error page fail-safe created
- Front page updated
Post your issues here.
Android Smart WebView 3.5
Android Smart WebView 3.5 comes with few bug fixes and a minor update. Now you can enable pull to refresh your webpage.
Newly introduced variables:
ASWP_PULLFRESH to enable/disable pull to refresh feature. Easy.
Post your issues here.
Android Smart WebView 3.0
Android Smart WebView 3.0 is here after quite a time refining and fixing bugs. We also have here some new features and upgrades. Like a separate download managing intent to handle multiple file downloads and improved image upload/management system.
Files are minimized and less messy now, config file is separated from Main script to SmartWebView.java for safe handling.
Newly introduced variables:
ASWP_ONLYCAM where you can choose to use just camera to upload pictures.
And Rating variables are separated from main activity too.
ASWR_DAYS
ASWR_TIMES
ASWR_INTERVAL
Drop your issues here.
Android Smart WebView 2.0
Android Smart WebView 2.0 is quite an upgrade after a year and now supports more Android functions than ever before.
As like previous version Smart WebView lets your webpage/website work as a native application for Android Devices by interacting with advanced android functions like GPS Tracking, File Explorer, Camera Photo Upload and lot more.
This version requires minimum API 19 (ASWV v1.0 had min. req. of API 16) as we should move towards advancements and many features in newer APIs makes it harder to put all of this (old+new functions) in a single application.
Android SmartWebView 1.0
v1.0 Introduced new variables