star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
83 stars 54 forks source link

Cannot discovery in Android #48

Closed louistanntt closed 1 year ago

louistanntt commented 2 years ago

In iOS I found 2 printers (TSP650II and mC_Print3) by Lan. But in Android, I could not find any devices. Here is my problem:

try {
      let manager = await StarDeviceDiscoveryManagerFactory.create(interfaceType);

      manager.discoveryTime = 10000;

      let newPrinters = [];

      manager.onPrinterFound = (printer) => {
        // iOS working well but Android does not
        newPrinters.push(printer);
        newPrinters = newPrinters.filter(
          (thing, index, self) =>
            index ===
            self.findIndex(
              (t) => t?.connectionSettings?.identifier === thing?.connectionSettings?.identifier,
            ),
        );
        setState({ ...state, printers: newPrinters });
        setStartFind(false);
      };

      manager.onDiscoveryFinished = () => {
        setStartFind(false);
      };

      await manager.startDiscovery();
    } catch (error) {
      setStartFind(false);
      alert(error);
    }

Any solution for this problem. Thank you!

Frankiz123 commented 2 years ago

same problem any solution @louistanntt ?

jesperjohansson commented 2 years ago

I have the same issue on Android emulator. Do you have the problem on a physical device?

bandit-ibayashi commented 2 years ago

As far as I have confirmed, I was able to search for LAN printers on Android using a Google Pixel 4a (Android 12). If you continue to be unable to search on your actual Android device, please provide us with detailed information about your Android device.

Frankiz123 commented 2 years ago

@bandit-ibayashi why app is crash on andorid tablet or android phone when i click print but works fine on ios

Frankiz123 commented 2 years ago

@bandit-ibayashi i am using bluetooth for printing receipt

gare-bear commented 2 years ago

@Frankiz123 Unless you're having a problem with printer discovery, this isn't the right place to ask this question. Please open a new issue.

Frankiz123 commented 2 years ago

yes @gare-bear

Frankiz123 commented 2 years ago

ok @gare-bear i will create a new ticket

gare-bear commented 2 years ago

@louistanntt are you still having this issue? Bandit tested and couldn't reproduce.

bandit-ibayashi commented 1 year ago

Since this Issue has not moved for a while and we have not been able to reproduce it here, we are closing it. If you continue to experience similar problems, please start a new Issue.