Skip to content

mgks/Android-SmartWebView

Repository files navigation

Android Smart WebView

Smart WebView Icon

Variant GitHub Release GitHub License

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

Core Features

  • 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 and MainActivity.java.

Plugins

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, JSInterfacePlugin.java) are located in /plugins/. These serve as excellent references for creating new plugins.
  • Testing Plugins:

    • Playground.java is used to configure, test, and demonstrate plugin functionality during development.
  • 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.

Quick Start

  1. Clone the repository:
    git clone https://github.com/mgks/Android-SmartWebView.git
  2. Open in Android Studio:
    • File > Open > Select the project folder
  3. 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 the app/ directory.
  4. Build & Run:
    • Build > Clean Project then Build > Rebuild Project

Basic Configuration

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 if ASWV_APP_URL points to a local file or if no internet is detected (and ASWP_OFFLINE logic permits).
  • Feature Toggles:
    • Enable or disable features (file uploads, camera access, location services, pull-to-refresh, etc.) by modifying the boolean ASWP_* variables.
  • 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 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 & Understanding the Code

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: 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.

Contributing & Support

License

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!

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

 

Contributors 10

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy