felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.81k stars 590 forks source link

closing port when service is destroyed #194

Closed felHR85 closed 5 years ago

mws-rmain commented 5 years ago

should also apply to examplemultipleports\UsbService.java?

    @Override
    public void onDestroy() {
        super.onDestroy();
        for (UsbSerialDevice dev: serialPorts) {
            dev.close();
        }
        if(builder != null)
            builder.unregisterListeners(context);
        UsbService.SERVICE_CONNECTED = false;
    }