iot - Amazon Web Services MQTT -


i working on amazon based web services have send , receive information amazon iot , receive message there. have problem in connecting iot , can 1 me mqtt , iot.

try this. may you.

credentialsprovider = new cognitocachingcredentialsprovider(             getapplicationcontext(), // context             cognito_pool_id, // identity pool id             my_region // region);      region region = region.getregion(my_region);      // mqtt client     mqttmanager = new awsiotmqttmanager(clientid, customer_specific_endpoint);      // set keepalive 10 seconds.  recognize disconnects more send     // mqtt pings every 10 seconds.     mqttmanager.setkeepalive(10);     miotandroidclient = new awsiotclient(credentialsprovider);     miotandroidclient.setregion(region);     try {             mqttmanager.connect(clientkeystore, new awsiotmqttclientstatuscallback() {                 @override                 public void onstatuschanged(final awsiotmqttclientstatus status,                         final throwable throwable) {                     log.d(log_tag, "status = " + string.valueof(status));                      runonuithread(new runnable() {                         @override                         public void run() {                             if (status == awsiotmqttclientstatus.connecting) {                                                                } else if (status == awsiotmqttclientstatus.connected) {                                 tvstatus.settext("connected");                              } else if (status == awsiotmqttclientstatus.reconnecting) {                                 if (throwable != null) {                                     log.e(log_tag, "connection error.", throwable);                                 }                                 tvstatus.settext("reconnecting");                             } else if (status == awsiotmqttclientstatus.connectionlost) {                                 if (throwable != null) {                                     log.e(log_tag, "connection error.", throwable);                                 }                                                                                     }                         }                     });                 }             });         } catch (final exception e) {                 } 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -