x2y Web2Droid API
Convert any website URL into a fully installable Android APK
Overview
The Web2Droid x2y API is a robust Node.js-based service designed to transform any website URL into a fully installable Android APK. It functions as a powerful system that wraps web content within a customized WebView container—much like a Progressive Web App (PWA) on steroids—then packages it as a native Android application.
This API automates the entire process: it fetches the provided website, intelligently analyzes its structure and metadata, generates all necessary Android project files (including Java code, XML resources, and build scripts), and compiles them into a downloadable Android APK file.
Key Features
Universal URL Support
Works with any valid website URL
Custom Package Names
Specify your own Android package identifier
Offline Capabilities
Built-in service worker support for offline functionality
Push Notifications
Optional push notification integration
Custom Icons & Splash
Provide custom icon and splash screen images
Advanced WebView
Configure WebView settings like JavaScript, zoom controls
Additional Permissions
Request specific Android permissions beyond defaults
PWA Integration
Full Progressive Web App feature support
Installation
NPM (Project)
npm install x2y-web2droid-x2y-apiGitHub (Source)
git clone https://github.com/x2yDevs/web2droid-x2y-api.git
cd web2droid-x2y-api
npm installPrerequisites
Ensure you have the following installed:
- •Node.js: Version 14 or higher
- •Android SDK: With Build-Tools and Platform-Tools
- •Java Development Kit (JDK): Version 8 or higher
- •Gradle: Bundled with Android Studio
Environment Variables
Set the following environment variables:
# Windows
set ANDROID_HOME=C:\Users\[YourUsername]\AppData\Local\Android\Sdk
# macOS/Linux
export ANDROID_HOME=/Users/[YourUsername]/Library/Android/sdk
# Add to PATH
%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\tools
%ANDROID_HOME%\cmdline-tools\latest\binUsage
1. Start the API Server
npm start
# Server runs on http://localhost:30002. Generate an APK
Send a POST request to generate an APK:
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. Request Body Parameters
url (required)
The URL of the website to convert
packageName (required)
The desired Android package name (e.g., com.yourcompany.yourapp)
options (optional)
offlineMode, pushNotifications, appName, appDescription, customIconUrl, customSplashUrl, webViewOptions, additionalPermissions
4. Check Job Status
GET http://localhost:3000/api/v1/job/exampleJobId
# Response includes status (processing/completed), progress, logs, and downloadUrl5. Download the APK
GET http://localhost:3000/api/v1/download/exampleJobId
# Downloads the completed APK file