Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
fix(mqtt): fix suscribe problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and Hector Rondon committed Nov 23, 2017
1 parent 584ffd0 commit 0f4f40c
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions app/src/main/java/org/flyve/mdm/agent/utils/MQTTHelper.java
Expand Up @@ -47,6 +47,7 @@
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Arrays;

public class MQTTHelper {

Expand Down Expand Up @@ -114,7 +115,7 @@ public void suscribe(final String channel) {
String[] topics = addTopic(channel);

// if topic null
if(topics==null) {
if(topics==null || topics.length == 0) {
FlyveLog.e("NULL TOPIC");
return;
}
Expand All @@ -124,7 +125,8 @@ public void suscribe(final String channel) {
qos[k] = 0;
}

FlyveLog.i("Topics: " + topics.length + " Qos: " + qos.length);
String str = Arrays.toString(topics);
FlyveLog.i("Topics: " + str + " Qos: " + qos.length);

try {
IMqttToken subToken = client.subscribe(topics, qos);
Expand Down Expand Up @@ -297,6 +299,21 @@ public void disableConnectivity(JSONObject json) {
broadcastReceivedLog(Helpers.broadCastMessage(MQTT_SEND, "UsbFileTransferProtocols", "UsbFileTransferProtocols is disable: " + disable));
}

if (jsonConnectivity.has("disableStatusBar")) {
boolean disable = jsonConnectivity.getBoolean("disableStatusBar");
new FlyveDeviceAdminUtils(context).disableStatusBar(disable);
}

if (jsonConnectivity.has("disableSreenCapture")) {
boolean disable = jsonConnectivity.getBoolean("disableSreenCapture");
new FlyveDeviceAdminUtils(context).disableCaptureScreen(disable);
}

if (jsonConnectivity.has("resetPassword")) {
String newpassword = jsonConnectivity.getString("resetPassword");
new FlyveDeviceAdminUtils(context).resetPassword(newpassword);
}

}
} catch (Exception ex) {
broadcastReceivedLog(Helpers.broadCastMessage(ERROR, "Error on disableConnectivity", ex.getMessage()));
Expand Down

0 comments on commit 0f4f40c

Please sign in to comment.