Overview
Custom device naming allows you to assign friendly, memorable names to your Android devices instead of seeing serial numbers or auto-detected model names. Names are persistent across sessions and shared between the web interface and CLI tool.Why Custom Names?
Device identifiers can be hard to remember:- Serial numbers:
R58N123456A(cryptic) - IP addresses:
192.168.1.100:5555(changes with network) - Auto-detected names:
Samsung SM-G991B(technical model codes)
- Personal devices: “My Phone”, “Work Phone”
- Testing devices: “Test Device - Android 13”, “QA Phone”
- Family devices: “Dad’s Tablet”, “Kids’ Phone”
Custom names appear throughout the interface, in device lists, dropdowns, and connection dialogs.
Setting Device Names
Via Web Interface
- Open device list in the web interface
- Click the device you want to rename
- Click the pencil/edit icon next to the device name
- Enter your custom name in the modal dialog
- Click Save - the name appears instantly
Via CLI
The batch script (apk-downloader.bat) includes a device naming menu:
Storage System
Custom names are stored indevice-names.json in the application root:
Storage Format
- Key: Device serial number (USB) or connection string (WiFi)
- Value: Custom name string
- Encoding: UTF-8 JSON with pretty-printing (2-space indent)
The serial number is the unique identifier, even if the device connects via different methods (USB vs WiFi).
API Implementation
Get All Device Names
Set Device Name
Delete Device Name
Display Priority
When displaying devices, APK Extractor follows this priority order:- Custom Name (if set)
- Auto-detected Label (brand + model)
- Serial Number (fallback)
Display Examples
| Custom Name | Auto-detected | Serial | Display |
|---|---|---|---|
| ”My Phone” | Samsung Galaxy S21 | R58N123456A | My Phone |
| null | Samsung Galaxy S21 | R58N123456A | Samsung Galaxy S21 |
| null | null | R58N123456A | R58N123456A |
| "" | Samsung Galaxy S21 | R58N123456A | Samsung Galaxy S21 |
Shared Across Interfaces
Thedevice-names.json file is shared between:
- Web interface (
server.js+public/app.js) - CLI tool (
apk-downloader.bat)
Synchronization
- No polling needed: Both interfaces read from same file
- Instant updates: Changes persist immediately to disk
- Cache invalidation: In-memory cache updates on write
- Crash-safe: JSON written atomically with pretty-printing
Caching Strategy
APK Extractor caches device names in memory for performance:Cache Benefits
- Fast reads: No disk I/O after first load
- Instant updates: Cache updates on every write
- Low memory: Single object, minimal footprint
- No stale data: Write-through caching ensures consistency
Use Cases
Personal Device Collection
Personal Device Collection
QA/Testing Environment
QA/Testing Environment
Family Devices
Family Devices
Validation
The API validates custom names:Validation Rules
- Required: Name cannot be empty or whitespace-only
- Trimmed: Leading/trailing whitespace removed automatically
- No length limit: Any length accepted (reasonable names recommended)
- Unicode support: Full UTF-8 character support (emojis, special chars)
Empty strings are rejected, but deleting a name (DELETE request) is allowed and removes the custom name entirely.
Best Practices
- Be descriptive: Include device model or purpose
- Keep it short: Long names may truncate in narrow UI
- Use consistent naming: Apply a naming scheme across devices
- Avoid special characters: Stick to alphanumeric for compatibility
- Update when needed: Change names as device purposes change
Good Examples
- “My Phone”
- “Test Device - Android 13”
- “Office Galaxy S21”
- “Dev Phone (Rooted)“
Avoid
- "" (empty)
- “Device” (too generic)
- “192.168.1.100:5555” (defeats the purpose)
- Very long names that describe entire device specs
