
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
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
swv.properties
). - Custom UI Modes: Fullscreen and drawer layouts (configurable in
swv.properties
). - 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
swv.properties
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
,LocationPlugin.java
) are located in/plugins/
. These serve as excellent references for creating new plugins.
- The core contract is defined in
-
Configuring & Testing Plugins:
Playground.java
is used to configure, test, and demonstrate plugin functionality during development. This is where you set plugin-specific options like AdMob IDs or enable Biometric Auth on launch.
-
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
- Configure
swv.properties
:- Open
app/src/main/assets/swv.properties
. - Change
app.url
to your website's URL and adjust other settings as needed. This is the main configuration file for the app.
- Open
- Add
google-services.json
(Optional):- 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
All primary configuration is done within app/src/main/assets/swv.properties
:
- Main Application URL:
- Set
app.url
to your web application's address. offline.url
(file:///android_asset/web/offline.html
) is used if no internet is detected.
- Set
- Feature Toggles:
- Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the
feature.*
boolean properties.
- Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the
- 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:
app/src/main/assets/swv.properties
: Contains all global configurations.SWVContext.java
: The central class that loads the configuration and holds app state.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!