Use the USB Connector extension to connect a USB printer (or any other USB device) to your app. You can use the USB connection to send ESC/POS commands to your printer. The extension automatically detects if a device has been attached or detached.
If your phone or tablet has a micro USB jack, you can either charge the Android device or connect a USB device, but not both at the same time. This is in accordance with the USB specifications. Simultaneously charging and transferring data is only possible with USB type C.
Note that there is a known issue: When attaching the device for the first time, the system user interface restarts and the lock screen is shown. This bug has already been reported by other developers and I wasn't able to solve it, neither.
DeviceChanged: When a USB device is attached or detached, an event is raised to inform the app.
If a device isAvailable, you can call the Connect procedure. If the connection has been established successfully, the attribute isConnected returns true.
Now you can send data via SendBytes, for example using the output of the ESC/POS Simple Converter to send data in the right format to your ESC/POS printer.
Use ResetConnection to destroy the current connection.