Android Smart WebView 7.1 🎉 (Plugins Release) #334
mgks
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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 theASWP_PLUGIN_SETTINGS
map inSmartWebView.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:
🐛 Fixes & Improvements
This release also includes several important fixes and modernizations:
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 deprecatedstartActivityForResult
calls.GPSTrack.java
to handle cases where a location provider is unavailable, preventing potential null pointer exceptions.aswm_host
) has been refined for better accuracy.For Developers
PluginInterface
and add a static block for self-registration. SeeToastPlugin.java
for a complete example.Playground.java
class is the best place to start for testing your new plugins. Add your plugin to the diagnostic checks and the demo UI.ASWP_PLUGINS
flag is set tofalse
. You can also toggle individual plugins in theASWP_PLUGIN_SETTINGS
map.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.
This discussion was created from the release Android Smart WebView 7.1 🎉 (Plugins Release).
Beta Was this translation helpful? Give feedback.
All reactions