Web2Droid x2y API v1.0.2: The Ultimate Web-to-APK Conversion Engine by x2y devs tools

Web2Droid x2y API v1.0.2: The Ultimate Web-to-APK Conversion Engine
>

🚀 Introducing Web2Droid x2y API v1.0.2: The Ultimate Web-to-APK Conversion Engine

npm version

The Web2Droid x2y API v1.0.2 is a robust and sophisticated Node.js-based service developed by **X2Y Devs Tools** to streamline the conversion of any publicly accessible website URL into a fully functional, installable **Android Application Package (APK)**.

This utility is a system that takes **ANY website URL** and "spits out" an installable Android APK by **wrapping the website inside a customized WebView container**—operating like a **PWA on steroids**—then packages it as a real Android app with permissions, custom icons, **offline capabilities**, and **background services**.

Developed by **X2Y Devs Tools**.


>

🛠️ What It Does: Core Functionality

The Web2Droid x2y API automates the entire process of creating Android applications from web content. It functions as a powerful, headless build system:

  1. **Fetching and Analysis**: The service fetches the provided website URL, analyzes its structure, and extracts essential metadata (like title and description).
  2. **Project Scaffolding**: It intelligently generates all necessary Android project files, including core **Java code** (for the WebView Activity), **XML resources** (layouts, strings), and **Gradle build scripts**.
  3. **Compilation**: It executes the Android SDK's **headless build tools (Gradle)** to compile the generated project structure into the final, runnable **Android APK file**.

The core capability lies in wrapping websites in a customized WebView container, automatically generating Android project files, building APKs using headless build tools (Gradle + Android SDK), and providing downloadable artifacts with full Android compatibility. Version 1.0.2 adds significant enhancements for customization and robustness.


>

✨ Advanced Features in Version 1.0.2

Version 1.0.2 dramatically expands customization, security, and build reliability, making the API a highly flexible tool.

>

Customization and Branding

  • **Custom App Icon/Splash Screen**: Provides complete visual control. Users can supply custom icon and splash screen images via **URL** (`customIconUrl`/`customSplashUrl`) or as a **Base64 encoded string** (`customIconData`/`customSplashData`).
  • **Custom App Name/Description**: Override default app name and description extracted from website metadata.
  • **Custom Package Names**: Specify your own Android package identifier (e.g., `com.yourcompany.yourapp`).
  • **Icon Generation**: Automatic app icon creation from website favicon (if a custom icon is not provided).
>

Web-to-Native Integration

  • **Universal URL Support**: Works with any valid website URL.
  • **PWA Integration**: Full **Progressive Web App feature support**.
  • **Offline Capabilities**: Built-in **service worker support** for offline functionality.
  • **Push Notifications**: Optional **push notification integration**.
  • **Background Services**: Support for background operations.
  • **Permission Management**: Automatic permission detection and handling for basic needs.
>

Advanced Configuration

  • **Advanced WebView Options**: Configure core WebView settings via the `webViewOptions` object:
    • **JavaScript**: `javaScriptEnabled`
    • **Zoom Controls**: `builtInZoomControls`
    • **DOM Storage**: `domStorageEnabled`
    • **Database**: `databaseEnabled`
    • **Viewport**: `loadWithOverviewMode` and `useWideViewPort`
  • **Additional Permissions**: Request specific Android permissions beyond defaults (e.g., `android.permission.CAMERA`) via the `additionalPermissions` array.
>

Stability and Security

  • **API Endpoint for Downloads**: Dedicated endpoint (`/api/v1/download/{jobId}`) for securely downloading completed APKs with **expiry checks**.
  • **Build Process Improvements**: Includes a **timeout** mechanism and **build log capture** for better error reporting.
  • **Security Enhancements**: Basic **input validation** and **resource limits** (e.g., size limits for Base64 data) to prevent abuse and ensure stability.

>

📥 System Requirements

To run the Web2Droid x2y API, your system must meet specific software and configuration prerequisites for the Android build environment.

  • **Node.js** (v14 or higher)
  • **Java Development Kit (JDK)** 8 or higher
  • **Android Studio** with SDK (specifically build-tools, platform-tools, cmdline-tools)
  • **Gradle** build system (included with Android Studio)
  • **Operating System**: Windows, macOS, or Linux

>

⚙️ Installation and Environment Setup

>

1. Prerequisites and Environment Variables

The most critical step is configuring your environment for Android development.

  • **Node.js**: Install from https://nodejs.org/.
  • **Android SDK**: Download and install Android Studio from https://developer.android.com/studio. Ensure you install the necessary components via the SDK Manager:
    • Android SDK Build-Tools (latest recommended)
    • Android SDK Platform-Tools
    • Android SDK Command-line Tools
    • An appropriate Android SDK Platform (API level 33 recommended)
  • **Environment Variables**: You **must** set the **ANDROID_HOME** environment variable to your Android SDK location (e.g., C:\Users\[YourUsername]\AppData\Local\Android\Sdk on Windows). Additionally, you need to add the SDK tool directories to your system's **`PATH`** variable: `%ANDROID_HOME%\platform-tools`, `%ANDROID_HOME%\tools`, `%ANDROID_HOME%\cmdline-tools\latest\bin`.
  • **Gradle**: Ensure Gradle is accessible via the command line (gradle -v should work).
>

2. Clone and Install Dependencies

If you have the source code locally:

cd C:\path\to\your\projects

git clone https://github.com/x2yDevs/web2droid-x2y-api.git

cd web2droid-x2y-api

If you are creating a new project directory:

mkdir web2droid-x2y-api

cd web2droid-x2y-api

Install all required Node.js packages:

npm install

>

💻 Configuration and Usage

>

Configuration

The API uses default settings defined in the index.js file. These can be adjusted via environment variables or by modifying the source code (e.g., default ports, directories like BASE_DIR and TEMP_DIR).

>

1. Start the API Server

Run the server command:

npm start

The server will start and listen on the default port (3000), displaying a message like Web2Droid x2y API v1.0.2 running on port 3000.

>

2. Generate an APK (POST /api/v1/generate-apk)

Send a POST request with the required parameters to the generation endpoint.

Example Request Payload:

{

  "url": "https://example.com",

  "packageName": "com.example.myapp",

  "options": {

    "offlineMode": true,

    "pushNotifications": false,

    "appName": "My Custom App",            // Optional: Custom app name

    "appDescription": "A custom app.",     // Optional: Custom app description

    "customIconUrl": "https://example.com/icon.png", // Optional: Custom icon via URL

    "customIconData": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", // Optional: Custom icon as base64 string

    "customSplashData": "...",             // Optional: Custom splash as base64 string

    "webViewOptions": {                    // Optional: WebView settings

      "javaScriptEnabled": true,

      "builtInZoomControls": true,

      "domStorageEnabled": true

    },

    "additionalPermissions": [             // Optional: Additional Android permissions

      "android.permission.CAMERA",

      "android.permission.WRITE_EXTERNAL_STORAGE"

    ]

  }

}

Example Request using `curl`:

curl -X POST http://localhost:3000/api/v1/generate-apk \

-H "Content-Type: application/json" \

-d '{

  "url": "https://google.com",

  "packageName": "com.example.googleapp",

  "options": {

    "offlineMode": true,

    "appName": "Google App",

    "customIconUrl": "https://example.com/myicon.png"

  }

}'
>

3. Check Job Status (GET /api/v1/job/{jobId})

The initial POST request provides a jobId. Use this ID to track the progress and status of the build.

Example Completed Response:

{

  "id": "job_1234567890_abc123def",

  "url": "https://google.com",

  "packageName": "com.example.googleapp",

  "options": { ... },

  "status": "completed",

  "createdAt": "2025-11-22T10:00:00.000Z",

  "progress": 100,

  "downloadUrl": "/api/v1/download/job_1234567890_abc123def",

  "expiresAt": "2025-11-23T10:00:00.000Z",

  "logs": [ ... ]

}
>

4. Download the APK (GET /api/v1/download/{jobId})

Use the downloadUrl once the status is completed. This endpoint securely serves the APK file from the server's `builds` directory, verifying job existence, completion, and expiration.


>

➡️ API Endpoints Summary

Method Endpoint Description
GET / API information and available endpoints.
GET /health Health check.
POST /api/v1/generate-apk Initiate APK generation.
GET /api/v1/job/{jobId} Check job status.
GET /api/v1/download/{jobId} Download completed APK.

>

🛑 Stopping the Server

To stop the API server, press Ctrl+C in the terminal window where it's running. This will terminate the Node.js process and stop the server.


>

🔗 Made by x2y dev tools

The Web2Droid x2y API is a flagship utility from the **x2y dev tools** suite.


>

Video Guide: Setting Android Environment Variables

For visual guidance on setting up your Android environment, you can refer to this video guide:

Title: How to set ANDROID_HOME and environment variable for Android SDK in Windows 10

The video explains the process of setting the necessary **ANDROID_HOME** path in Windows to ensure the Android SDK tools are correctly recognized by your system [00:00:16].

Watch the full video on YouTube.

Comments