Skip to content

MohammedEl-sayedAhmed/UberBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UberBot

Automated Uber shuttle reservation bot for Xiaomi devices using Automate and Autox.js. All tools are free -- no paid apps required.


Table of Contents


Prerequisites

Install the following free apps before proceeding with device setup:

App Source Purpose
Uber Play Store Shuttle booking target app (must be logged in)
Autox.js GitHub Releases (download arm64-v8a APK) JavaScript-based UI automation via Accessibility Service
Automate Play Store (LlamaLab) Flow-based task automation and scheduling

All automation operates through the Android Accessibility Service -- no root access is required. All tools are free and open-source or free-tier.


Device Setup (MIUI / HyperOS)

Target device: Xiaomi 15T Pro running MIUI 15 / HyperOS

MIUI aggressively kills background apps to save battery. Every step below is critical to ensure Automate and Autox.js survive overnight and multi-day idle periods. Complete all steps for both Automate and Autox.js unless otherwise noted.

Note: MIUI updates may reset some of these settings. Re-verify all steps after any system update.

1. Battery Optimization Whitelisting

Prevents MIUI from restricting background activity for Automate and Autox.js. Setting "No Restrictions" also disables battery saver for the app, covering both whitelisting and battery saver requirements.

For Automate:

  1. Open Settings
  2. Go to Battery > Battery Saver > App Battery Saver
  3. Find Automate in the app list
  4. Select No Restrictions

For Autox.js:

  1. Open Settings
  2. Go to Battery > Battery Saver > App Battery Saver
  3. Find Autox.js in the app list
  4. Select No Restrictions

On HyperOS, the path may appear as Settings > Battery > More battery settings > App battery saver. Look for the equivalent "No Restrictions" option.

2. Autostart

Ensures both apps launch automatically after device restart.

  1. Open Settings
  2. Go to Apps > Autostart
  3. Toggle ON for Automate
  4. Toggle ON for Autox.js

On HyperOS, this may be under Settings > Apps > Permissions > Autostart.

3. App Lock

Prevents MIUI from force-stopping apps during periodic "clean up" sweeps.

  1. Open Settings
  2. Go to Apps > App Lock
  3. Add Automate to the locked apps list
  4. Add Autox.js to the locked apps list

App Lock ensures MIUI does not include these apps when it cleans up background processes.

4. Accessibility Service

Autox.js requires the Accessibility Service to read and interact with UI elements in the Uber app.

  1. Open Settings
  2. Go to Additional Settings > Accessibility > Installed Apps
  3. Find Autox.js
  4. Toggle ON
  5. Confirm the permission dialog

On HyperOS, the path may be Settings > Additional Settings > Accessibility > Downloaded apps > Autox.js.

5. Notification Access

Automate requires notification access to manage and deliver booking notifications.

  1. Open Settings
  2. Go to Notifications > Notification Access
  3. Find Automate
  4. Toggle ON
  5. Confirm the permission dialog

On HyperOS, the path may be Settings > Notifications > Advanced settings > Notification access.


Uber App Requirements

  • Uber must be installed and logged in before running any automation. The bot interacts with the Uber app through UI elements -- it does not use the Uber API or require separate authentication.
  • Accessibility Service interaction model: Autox.js reads and clicks UI elements via the Android accessibility tree. This means:
    • The Uber app must be in a normal (not crashed or logged-out) state
    • No root access or special Uber permissions are needed
    • All automation works through standard Accessibility Service APIs
  • Coexistence with normal usage: The automation runs as a background service and does not hijack the foreground. You can use your phone normally while the bot is idle.

App Configuration

After completing device setup:

Autox.js Scripts

  1. Copy the contents of the autojs/ directory to /sdcard/Scripts/autojs/ on your device
  2. Open Autox.js and load the scripts from that directory
  3. Ensure the script service is running

Configuration File

The bot reads its configuration from /sdcard/Scripts/autojs/ubot-config.json. If this file is missing, the bot uses sensible defaults. To customize, create the file with your settings:

{
  "workingDays": ["Sun", "Mon", "Tue", "Wed", "Thu"],
  "goTime": "08:00",
  "returnTime": "17:00",
  "pickupStop": "",
  "dropoffStop": ""
}
  • workingDays: Days of the week the shuttle runs (comma-separated abbreviations)
  • goTime / returnTime: Departure and return times in HH:MM format
  • pickupStop / dropoffStop: Your shuttle stop names (leave empty to use defaults)

Automate Flows

Create the automation flows in Automate following the Automate Setup Guide. There are 4 flows to create:

  1. Evening Reminder -- Sun-Wed at 21:00
  2. Saturday Check-In -- Saturday at 10:00
  3. Wednesday Booking -- Wednesday at 09:50
  4. Ride Status Check -- Sun-Thu at 06:00 and 16:00

Verify all flows are started (shown with a green play icon).

Runtime Files

The bot automatically creates and manages these files:

  • autojs/state.json -- Persistent state (booking status, retry counts). Created automatically on first run. If corrupted, the bot resets it and saves a backup as state.json.bak.
  • logs/ -- Daily log files (booking-YYYY-MM-DD.log). Automatically rotated after 14 days.

Troubleshooting

App killed after screen off / overnight

Symptoms: Automate or Autox.js stops running after the screen turns off or after leaving the device idle overnight.

Fixes:

  1. Re-verify all whitelisting steps in Device Setup above
  2. Confirm App Lock is enabled for both apps (see App Lock)
  3. Last resort: Enable Developer Options and disable MIUI Optimization:
    • Settings > Additional Settings > Developer Options > MIUI Optimization > toggle OFF
    • Restart the device when prompted
    • Warning: This is a system-wide change that affects all apps (permissions, notifications, etc.). Only use this if the steps above did not resolve the issue. It can be re-enabled the same way.
  4. Check that no third-party battery saver or cleaner app is killing background processes

No booking confirmation notification

Symptoms: The automation runs but no notification appears confirming the booking.

Fixes:

  1. Verify notification access is granted for Automate (see Notification Access)
  2. Check notification channel settings for Automate in Settings > Notifications > App notifications > Automate
  3. Ensure Do Not Disturb is either off or has exceptions for Automate
  4. Verify Automate has "Show notifications" enabled

Verifying services are running

Check Automate:

  1. Open Automate
  2. Verify flows are running (shown with a green play icon)
  3. If a flow is stopped, tap it and press the play button

Check Autox.js:

  1. Open Autox.js
  2. Verify the script service is running (shown in the status bar)
  3. If not running, tap the play button or restart the service

Check Accessibility Service:

  1. Open Settings > Additional Settings > Accessibility > Installed Apps
  2. Verify Autox.js shows as enabled
  3. If disabled, toggle it back on (MIUI may disable it after updates)

Device restart recovery

Automate and Autox.js should auto-launch on boot if Autostart is enabled (see Autostart).

If apps don't start after reboot:

  1. Verify Autostart is still enabled for both apps (Automate and Autox.js)
  2. Check that Automate has "Run on system startup" enabled in its settings
  3. Manually open both Automate and Autox.js once to re-initialize background services
  4. Re-verify Accessibility Service is enabled for Autox.js (it may get disabled after reboot on some MIUI versions)

Project Structure

UberBot/
├── autojs/          # Autox.js scripts (deployed to /sdcard/Scripts/autojs/)
│   ├── main.js      # Main entry point (dispatcher)
│   ├── config.js    # Configuration module
│   ├── booking.js   # Booking flow orchestrator
│   ├── log.js       # Logging module
│   ├── state.js     # State management module
│   └── tests/       # Test files
├── automate/        # Automate setup guide
├── scripts/         # Utility scripts
├── docs/            # Project documentation
└── README.md        # This file

About

Uber shuttle bus reservation automation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors