react-native-esc-pos-printer: Cannot find any printer on Kiosk device!!

Hi, I’m intergrating the library for a kiosk device with printer connected via USB port image My app working okay with my tablet but It couldn’t find any printer on kiosk image

Didn’t return any error, it’s just discover forever.

I tried again with other app: TM Assistant and it can detect my printer normally image My printer is EU-m30

Do you know why? May I missed some configuration from android native ?

Kiosk found new USB device in android logcat:

11-18 09:38:50.218     0     0 I usb 5-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
11-18 09:38:50.218     0     0 I usb 5-1.2: Product: EU-m30
11-18 09:38:50.218     0     0 I usb 5-1.2: Manufacturer: EPSON
11-18 09:38:50.218     0     0 I usb 5-1.2: SerialNumber: <hidden>
11-18 09:38:50.223     0     0 I usblp 5-1.2: 1.0: usblp0: USB Bidirectional printer dev 4 if 0 alt 0 proto 2 vid 0x04B8 pid 0x0E2E```

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 30 (21 by maintainers)

Most upvoted comments

@tr3v3r after executing the following code , try { const printers = await EscPosPrinter.discover(); console.log(“printers”, printers); } catch (error) { console.log(“Error:”, error); }

getting the following console errors

requestAndroidPermissions false Error: No permissions granted

I am using Expo React Native in Dev Client. and added these “permissions”: [ “android.permission.BLUETOOTH”, “android.permission.BLUETOOTH_ADMIN”, “android.permission.BLUETOOTH_CONNECT”, “android.permission.BLUETOOTH_SCAN”, “android.permission.INTERNET”, “android.permission.WRITE_EXTERNAL_STORAGE”, “android.permission.READ_EXTERNAL_STORAGE”, “android.permission.ACCESS_COARSE_LOCATION” ],

in app.json file.

Even if I request BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions using PermissionsAndroid from react native it is giving this response {“android.permission.BLUETOOTH_CONNECT”: “never_ask_again”, “android.permission.BLUETOOTH_SCAN”: “never_ask_again”}.

can you please check what is the issue ?

@tr3v3r Currently I have it patched for now, but if that will be possible will great, so I can also change it for devices that won’t have Google services on them, by parameter 🙏

@tr3v3r Thank you so much!! 🙏 That was the issue, the google services! I assume @nvdnvd00 had the same issue 😃

Okay thank you I will try those and get back to you 🙏

Nah, still an empty array Code:

 useEffect(() => {
    const test = async () => {
      const printers = await EscPosPrinter.discover();
      console.log(printers);
    };

    test();
  }, []);

Logs: LOG requestAndroidPermissions true LOG enableLocationSetting true LOG []

@nvdnvd00 Ok! Since your application works on tablets I suppose this is not a problem with the library for USB connections. What I can do: I’ll add support for x86_64 arch for Android (which is missed right now) in an upcoming release ( I’ll try to do it today ).

From your side: Please try to find what exactly happens when you try to discover on the Android side. Any errors/logs why you can not see the device. Also, double-check if all permissions are added according to the docs.

Also if its possible try to connect the printer with another connection type (Bluetooth, LAN )

@nvdnvd00 sorry but I need also processor architecture.

@tr3v3r Correct!

@tr3v3r I repeat “space” between left side and right side. It still works for long line with wrap. I’m waiting for kiosk information and will send it to you soon. Everything I know is meridian kiosk and it run on android 11

const printLeftRight = (
	printing: Printing,
	left: string,
	right: string,
	maxChar: number,
	size: TScalingFactors = 1,
) => {
	const totaLeft: number = left.length * size;
	const totaRight: number = right.length * size;
	const totalChar: number = totaLeft + totaRight;
	let centerSpaceLength: number = 0;
	let numberOfLines = 1;

	while (numberOfLines * maxChar < totalChar) {
		numberOfLines++;
	}

	centerSpaceLength = numberOfLines * maxChar - totalChar;

	printing
		.size(size)
		.text(left)
		.size(1)
		.text(' '.repeat(centerSpaceLength))
		.size(size)
		.text(right)
		.newline();
};

@nvdnvd00 Btw how did you achieve such a layout? I mean text on the left and right? image

asking because working right now on the way to do it