react-native-esc-pos-printer icon indicating copy to clipboard operation
react-native-esc-pos-printer copied to clipboard

Bluetooth printer not discoverable

Open omarst9 opened this issue 1 year ago • 12 comments

I can't get bluetooth connectivity to work with 3.1.1 or 4.0.6 versions. The printer is not discoverable on android and on iOS.

Printer model is TM-m30III. I confirmed connection works over LAN/WIFI. I'm using Expo SDK 50.

I have added all the permissions needed for android and followed the steps in the installation guide.

Has anyone had any luck with getting Bluetooth printers working with this library?

If I add the Bluetooth MAC Address manually to the code with the device name i can connect and print from the printer. Its just the discovery isnt working.

omarst9 avatar May 17 '24 09:05 omarst9

Hi @tolypash, i noticed you had a similar issue with Blutooth printers here. Can I ask how you got discovery to work sometimes? And did you end up resolving the issue?

omarst9 avatar May 17 '24 23:05 omarst9

Hello @omarst9,

I have this model and all works good at least with bare project. Have you paired your phone and printer before discovering?

With reproducible demon I can debug on my end

tr3v3r avatar May 18 '24 07:05 tr3v3r

Hi @tr3v3r,

Yes, I've paired the printer with the device first. I tried the example here and no bluetooth devices were discovered, only the LAN was found. (See attached image)

I tried the react-native-thermal-receipt-printer library and the printer was discovered so i'm not sure what could be wrong.

no-bte-device

omarst9 avatar May 19 '24 00:05 omarst9

@omarst9 have you tried increasing timeout? It helped me for Android discovery.start(10000)

tr3v3r avatar May 21 '24 08:05 tr3v3r

That worked! I just tried it for Android and it detected the BT device. But still no luck with the iPad though

omarst9 avatar May 21 '24 11:05 omarst9

That worked! I just tried it for Android and it detected the BT device. But still no luck with the iPad though

Have you done all these steps? They're not present in the example folder I guess. You should do it on your end

image

tr3v3r avatar May 21 '24 11:05 tr3v3r

Yes, I already added those before building the iOS app and checked again to make sure they were there but still no BT device comes back from the discovery.

omarst9 avatar May 22 '24 00:05 omarst9

@omarst9 and have you paired with the device, right?

tr3v3r avatar May 22 '24 08:05 tr3v3r

@omarst9 you have to use pair Bluetooth function from the package (for iOS only)

tolypash avatar May 22 '24 08:05 tolypash

Yes, i’ve paired the device from the iOS bluetooth settings.

I saw that pair bluetooth function but wasn’t too sure when to use it. Could you show me a snippet of when its used? Because from memory it needed the deviceName which means the BT printer needs to be discovered first.

omarst9 avatar May 22 '24 08:05 omarst9

@omarst9 it's not mandatory to use this function, to be honest.

Have you tried with the beta or the current version?

I've tested on beta Bluetooth connection and managed to discover on both platforms

tr3v3r avatar May 22 '24 09:05 tr3v3r

@omarst9 Disconnect the printer from iOS Bluetooth settings. Then request all necessary permissions from your app (Bluetooth, location).

Then, call PrintersDiscovery.pairBluetoothDevice()

A native popup should appear and select your printer from there, it will connect, and now it will be paired properly.

tolypash avatar May 22 '24 09:05 tolypash

i have the same problem. stuck in two days but still not solve the problem

aargon007 avatar Jul 16 '24 10:07 aargon007

@omarst9 Disconnect the printer from iOS Bluetooth settings. Then request all necessary permissions from your app (Bluetooth, location).

Then, call PrintersDiscovery.pairBluetoothDevice()

A native popup should appear and select your printer from there, it will connect, and now it will be paired properly.

hey , i have connect the printer from popup. but later i can't find the printer. how can i get it?

aargon007 avatar Jul 16 '24 10:07 aargon007

@aargon007 it never worked for me. I couldn't find the Bluetooth printer even after pairing

omarst9 avatar Aug 02 '24 03:08 omarst9

I checked on an example today - it works well on iOS and Android. The close issue for now. If you have a reproducible example please feel free to reopen it

tr3v3r avatar Aug 19 '24 13:08 tr3v3r