An Android application for configuring Sunmi printers' Wi-Fi settings via Bluetooth. This app allows you to connect to Sunmi printers (NT311, CloudPrinter, etc.) over Bluetooth and configure their Wi-Fi network settings.
- Bluetooth Scanning: Automatically scan and discover Sunmi printers
- Simple UI: Easy-to-use interface with two main screens
- Connect to printer via Bluetooth
- Configure Wi-Fi network settings
- Wide Compatibility: Works on Android phones and tablets (Android 5.0+)
- Sunmi Printer Support: Supports NT311, CloudPrinter, and other Sunmi printer models
- Android device running Android 5.0 (API 21) or higher
- Bluetooth enabled on the device
- Location permissions (required by Android for Wi-Fi scanning)
- Sunmi printer with Bluetooth capability
- Install Android Studio
- Clone or download this repository
- Open the project in Android Studio
- Wait for Gradle sync to complete
- Connect your Android device via USB (with USB debugging enabled) or use an emulator
- Click "Run" (or press Shift+F10) to build and install the app
- Install Android SDK Command Line Tools
- Set up your environment variables:
export ANDROID_HOME=/path/to/android/sdk export PATH=$PATH:$ANDROID_HOME/platform-tools
- Navigate to the project directory:
cd connectprinter - Build the debug APK:
./gradlew assembleDebug
- Build the Play Store release bundle:
./gradlew bundleRelease
- Outputs:
- Debug APK:
app/build/outputs/apk/debug/app-debug.apk - Release AAB:
app/build/outputs/bundle/release/app-release.aab
- Debug APK:
# On Linux/Mac
./gradlew clean assembleDebug
# On Windows
gradlew.bat clean assembleDebugThe debug APK will be at: app/build/outputs/apk/debug/app-debug.apk
For end-to-end Play upload steps, see PLAY_STORE_RELEASE.md.
adb install app/build/outputs/apk/debug/app-debug.apk- Copy the APK file to your Android device (via USB, email, cloud storage, etc.)
- On your Android device, navigate to the APK file using a file manager
- Tap the APK file to install
- You may need to enable "Install from Unknown Sources" in your device settings
- Upload the APK to a file hosting service (Google Drive, Dropbox, etc.)
- Share the download link with users
- Users can download and install directly on their Android devices
Open the "Sunmi Printer Config" app on your Android device.
- Tap the "Scan for Printers" button
- Grant Bluetooth and Location permissions when prompted
- Wait for the app to discover nearby Sunmi printers
- The app will show a list of available printers (filtered by name: NT311, CloudPrinter, SUNMI)
Tap on the printer you want to configure from the list.
- Select your store's Wi-Fi network from the dropdown
- Enter the Wi-Fi password
- Tap "Configure Printer"
- Wait for the configuration to complete
Once configuration is successful, the printer should automatically connect to the configured Wi-Fi network.
The app requires the following permissions:
- Bluetooth: To scan for and connect to printers
- Bluetooth Admin: Used on Android 11 and lower for legacy Bluetooth behavior
- Location (Android 6-11 only): Required by Android system behavior for Bluetooth discovery
- Wi-Fi State: To read available Wi-Fi networks
- Change Wi-Fi State: To configure Wi-Fi settings
All permissions are requested at runtime when needed.
- Ensure the printer is powered on
- Make sure Bluetooth is enabled on both the device and printer
- Try moving closer to the printer
- Restart the printer and try scanning again
- Verify the printer is not already connected to another device
- Restart Bluetooth on your Android device
- Try turning the printer off and on again
- Double-check the Wi-Fi password
- Ensure the Wi-Fi network is within range of the printer
- Some printers may require specific command formats - check your printer model documentation
- Grant Location permissions when prompted
- Enable Location services on your device
- On Android 10+, Wi-Fi scanning has privacy restrictions
The app uses the following methods to send Wi-Fi configuration to Sunmi printers:
-
Sunmi Proprietary Command:
- Command format:
0x1F 0x1B 0x1F 0x91 [SSID length] [SSID] [Password length] [Password] [Security type]
- Command format:
-
AT-Style Commands:
- Format:
AT+WIFI_CONF="SSID","PASSWORD"
- Format:
-
ESC/POS Extension:
- Format:
ESC 0x1F 0x10 WIFI:SSID,PASSWORD
- Format:
The app sends all three command formats to maximize compatibility across different Sunmi printer models.
- Uses Bluetooth SPP (Serial Port Profile)
- UUID:
00001101-0000-1000-8000-00805F9B34FB
connectprinter/
├── app/
│ ├── src/
│ │ └── main/
│ │ ├── java/com/sunmi/printerconfig/
│ │ │ ├── MainActivity.java # Bluetooth scanning screen
│ │ │ ├── WifiConfigActivity.java # Wi-Fi configuration screen
│ │ │ ├── BluetoothDeviceAdapter.java # RecyclerView adapter
│ │ │ └── PrinterConfigHelper.java # Printer communication logic
│ │ ├── res/
│ │ │ ├── layout/ # UI layouts
│ │ │ ├── values/ # Strings and resources
│ │ │ └── mipmap/ # App icons
│ │ └── AndroidManifest.xml
│ ├── build.gradle # App-level Gradle config
│ └── proguard-rules.pro
├── build.gradle # Project-level Gradle config
├── settings.gradle
└── gradle.properties
- MainActivity: Handles Bluetooth scanning and displays list of available printers
- WifiConfigActivity: Provides UI for selecting Wi-Fi network and entering password
- BluetoothDeviceAdapter: RecyclerView adapter for displaying Bluetooth devices
- PrinterConfigHelper: Core logic for connecting to printer via Bluetooth and sending Wi-Fi configuration commands
This project is provided as-is for configuring Sunmi printers.
For issues related to:
- App functionality: Check the troubleshooting section above
- Sunmi printer commands: Refer to Sunmi Developer Documentation
- Android development: See Android Developer Docs
- The app filters for Sunmi printers by name (NT311, CloudPrinter, SUNMI)
- Wi-Fi security type is set to WPA2-PSK by default (most common)
- Configuration is sent over Bluetooth SPP connection
- The app is compatible with Android 5.0+ (API level 21 and above)
- v1.0: Initial release with Bluetooth scanning and Wi-Fi configuration functionality