MarchellinAntonia / BluetoothPrinting

Learn how to build Android Apps that connect to printer via bluetooth and can print text and receipt (Android)
3 stars 3 forks source link

BluetoothPrinting

Learn how to build Android Apps that connect to printer via bluetooth and can print text and receipt (Android)

Getting Started

These app connect to printer via blutooth, so you need to enable bluetooth permission

These app send bulk SMS using GSM Modem (tested using Wavecom and Syscom MP8P) in this project there is 3 main Component:

Code

this app built using P25Connector lib to connect app with Printer using bluetooth and BroadcastReceiver to distribute the command, the connection step include:

bluetooth permission in manifest

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

The Connection need to send the printer serial number and pair it with phone using bluetooth sensor. every printer has different serial number, so don't use the example serial number

when executing the command, the code send intent with filter

IntentFilter filter = new IntentFilter();
     filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
     filter.addAction(BluetoothDevice.ACTION_FOUND);
     filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
     filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
     filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
registerReceiver(mReceiver, filter);

The Printer

you can use any bluetooth printer that support P25 to connect the device via bluetooth socket in this repository, the code example can print:

Built With

Authors

Screenshoot

no screenshoot yet