I send SMS via GSM device, try this: https://stackoverflow.com/a/31361225/6250402
It can send normal SMS, I try to send a Unicode text but It auto-convert to ASCII: VD¥n ba:#n D_a:?n: TBM01
Lib:
<dependency>
<groupId>com.neuronrobotics</groupId>
<artifactId>nrjavaserial</artifactId>
<version>5.1.1</version>
</dependency>
My code:
CommPortIdentifier portId = "I get CommPort match name";
SerialPort serialPort = portId.open("name", 2000);
serialPort.setSerialPortParams(115200, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
this.outputStream = serialPort.getOutputStream();
// each command function
private void send(String cmd) throws IOException {
outputStream.write(cmd.getBytes(StandardCharsets.UTF_8)); //
outputStream.flush();
}
// this sends message method
send("AT+CMGS=" + '"' + phone + '"' + "\r\n");
send(message + '\032');
Did I have the wrong config?
Any code to send SMS via GSM for java is a good answer.
Result I missing AT+CSMP=1,167,0,8
(https://stackoverflow.com/a/15312611/6250402, to more info, look https://www.smssolutions.net/tutorials/gsm/sendsmsat/)