Accessing the serial port on the back connector

Last updated: 2025-05-19

Related products: Nautiz X6v1Nautiz X2

There is an article for the pinout on Nautiz X2.

If you are using one of our RFID accessories, you can also use our Anysend app for easier implementation. Read this article to learn how.  

To simplify the connection to the serial port on the Nautiz X2 and the Nautiz X6, we have created a library that takes care of providing the correct path and handles power control depending on the hardware. 

Below you’ll find a short code example in Java. If you need access to the AAR file directly, you can find it here

Implement dependency

1
implementation 'com.handheldgroup.tools:serialport:1.5.0'

If the library can’t be found, you have to add a custom repository to you build file:

1
allprojects {
2
    repositories {
3
        ...
4
        maven { url "https://repo.repsy.io/mvn/handheldgroup/handheldgroup" }
5
    }
6
}
7


Connection setup

1
File port = new File(SerialPort.getSerialPath()); 
2
SerialPort.setDevicePower(this, true); 
3
mSerialPort = new SerialPort(port, 9600, 0); 
4
mOutputStream = mSerialPort.getOutputStream(); 
5
mInputStream = mSerialPort.getInputStream(); 
6
// Start reading and writing to device 
7