Hi!
I am using end devices + gateway + TTN server + java-app-sdk.
onMessage
event works well - I can detect all uplink messages from end devices sent to server. But no onActivation
event happens on adding new end device to TTN and passing join procedure. Here is code:
Client client = new Client(region, appId, accessKey);
client.onError((Throwable _error) -> log.warning("error: " + _error.getMessage()));
client.onConnected((Connection _client) -> log.info("connected !"));
client.onActivation((String devId, ActivationMessage data) -> {
log.info("\r\n====================================\r\n"
+ "AppEui: " + data.getAppEui()
+ "DevEui: " + data.getDevEui());
});
client.onMessage((String devId, DataMessage data) -> {
log.info("\r\n###############################"
+ "\r\nMessage from device " + devId + " with: "
+ "\r\nAppId: " + ((UplinkMessage)data).getAppId()
+ "\r\nDevId: " + ((UplinkMessage)data).getDevId()
+ "\r\nCounter: " + ((UplinkMessage)data).getCounter()
+ "\r\nHWserial: " + ((UplinkMessage)data).getHardwareSerial()
+ "\r\nPort: " + ((UplinkMessage)data).getPort()
+ "\r\nDataRaw: " + bytesToHex(((UplinkMessage)data).getPayloadRaw())
+ "\r\nGateway: " + ((UplinkMessage)data).getMetadata().getGateways().get(0).getId());
DownlinkMessage responce = new DownlinkMessage(((UplinkMessage)data).getPort(), "hello");
log.info("Sending");
try {
client.send(devId, responce);
} catch (Exception e) {
log.warning("Responce failed: " + e.getMessage());
}
});
client.start();
Here is sequence while trying to catch activation event:
- gateway stopped
- end device deleted from application on TTN server
- java-app-sdk started
- end device added to applicatioin on TTN server
- gateway started
- end device started
Join procedure passes succesfully (as well as activation on TTN):
but only uplink messages catched using onMessage
handler: