How to Check Device is Status with AWS Iot Core with AWS Android SDk

897 views Asked by At

I am created Android application communicate with AWS Iot Core using AWS Android SDK its perfectly working but If Device is disconnected while power or internet problem, I want to show status of Device is Connected or Disconnected, I found one using LastWillAndTestament showing device status but its not working Help me to solve this

String topic - $aws/things/LogoTest1/shadow/update

AWSIotMqttLastWillAndTestament lwt = new AWSIotMqttLastWillAndTestament(topic,
"Android client lost connection", AWSIotMqttQos.QOS0);
mqttManager.setMqttLastWillAndTestament(lwt);

Another one is https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-comms-app.html#thing-connection In the Developer guide shows To Create a rule that republishes the MQTT LWT message but there is no republishes the MQTT LWT message in Aws iot action it only have Republish a message to an AWS IoT topic Help me to solve this problem

1

There are 1 answers

0
puroh On

Maybe this work

Detecting a device is connected

To determine if a device is currently connected, include a connected property in the shadow document and use an MQTT Last Will and Testament (LWT) message to set the connected property to false if a device is disconnected due to an error.

https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-comms-app.html