Skip to content

A simple use webview integrated w/ native features & plugin support for building hybrid apps.

License

Notifications You must be signed in to change notification settings

mgks/Android-SmartWebView

Repository files navigation

Android Smart WebView

Smart WebView Logo

Language GitHub Release License

Android Smart WebView is a modern, open-source solution for building advanced hybrid Android apps. It provides a robust foundation for converting any website into a feature-rich mobile application, complete with a powerful plugin system for extending native functionality.

DOCUMENTATION | DISCUSSIONS | ISSUES

Core Features

  • Plugin Architecture: Extend app functionality with self-registering, modular plugins.
  • File Uploads & Camera Access: Full support for <input type="file">, including direct camera capture.
  • Push Notifications: Integrated with Firebase Cloud Messaging (requires google-services.json).
  • Google Analytics: Built-in support for usage tracking (configure GTAG ID in swv.properties).
  • Custom UI Modes: Choose between a fullscreen immersive layout or a standard drawer navigation layout.
  • Location Services: Access device GPS for location-aware web applications.
  • Content Sharing: Natively receive and handle content shared from other apps.
  • Downloads & Printing: Handle file downloads and print web content using native services.
  • Modern & Secure: Built with up-to-date libraries, security best practices, and highly configurable via swv.properties.

Included Plugins

Smart WebView now includes all plugins for free, providing a comprehensive toolkit to build powerful hybrid apps out of the box.

  • AdMob: Integrate Google AdMob banner, interstitial, and rewarded ads.
  • Biometric Authentication: Secure your app with fingerprint or face unlock.
  • QR & Barcode Reader: Natively scan QR codes and barcodes using the device camera.
  • Image Compression: Automatically compress images before uploading to save bandwidth and improve performance.
  • JS Interface: A powerful two-way bridge for seamless communication between your web app's JavaScript and native Android code.
  • Location: On-demand access to the device's GPS location.
  • Native Dialogs: Display native alert and confirmation dialogs from your JavaScript.
  • Toast Messages: Show short, non-blocking native toast notifications.
  • In-App Review: Prompt users to rate your app on the Google Play Store based on usage triggers.

Quick Start

  1. Clone the repository:
    git clone https://github.com/mgks/Android-SmartWebView.git
  2. Open in Android Studio:
    • File > Open > Select the cloned project folder
  3. 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.
  4. Add google-services.json (Optional):
    • If you plan to use Firebase services (like FCM for push notifications), place your google-services.json file from the Firebase console into the app/ directory.
  5. Build & Run:
    • Build > Clean Project then Build > Rebuild Project.

Basic Configuration

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.
  • Feature Toggles:
    • Enable or disable core features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the feature.* boolean properties.
  • 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.
  • Plugin Configuration:
    • Plugin-specific 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.

Further Information

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 that handles WebView setup and integrates core features.
  • PluginInterface.java & PluginManager.java: Key components of the plugin architecture.
  • Playground.java: The central place for configuring and testing plugins.
  • The plugins/ directory: Contains the full source code for all included plugins.

Contributing & Community

License

This project is licensed under the MIT License.

About

A simple use webview integrated w/ native features & plugin support for building hybrid apps.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project