
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 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 (
AdMobPlugin.java
,JSInterfacePlugin.java
,ToastPlugin.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.
- Included Plugins: The project includes an example plugin for Toasts. Plugins are designed to be self-registering.
- Premium Plugins: List of premium plugins for Project Sponsors.
- Admob: Integrate Google AdMob ads into your app.
- Google Auth: Add Google authentication for seamless sign-in.
- QR & Barcode Reader: Scan QR codes and barcodes directly from your app.
- Biometric Auth: Enable fingerprint or face authentication.
- Image Compression: Compress images before uploading for better performance.
- CSS Injection: Dynamically inject custom CSS into your web pages.
- Payment Gateway: Integrate payment solutions for in-app purchases.
- 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
- Adding/Modifying Plugins:
- Plugins are Java classes that implement
PluginInterface
. - They typically self-register with the
PluginManager
using a static block. - Refer to the existing plugins in the
/plugins/
directory for examples on how to create and integrate them.
- Plugins are Java classes that implement
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
,Playground.java
: Key components of the plugin architecture.- The
/plugins/
directory: Contains example 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!