From 0f4f40cf61428092068ff491b8381edc1d08eb62 Mon Sep 17 00:00:00 2001 From: Rafa Hernandez Date: Thu, 23 Nov 2017 12:58:51 -0400 Subject: [PATCH] fix(mqtt): fix suscribe problem --- .../org/flyve/mdm/agent/utils/MQTTHelper.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/flyve/mdm/agent/utils/MQTTHelper.java b/app/src/main/java/org/flyve/mdm/agent/utils/MQTTHelper.java index 607c49b264..bb89962306 100644 --- a/app/src/main/java/org/flyve/mdm/agent/utils/MQTTHelper.java +++ b/app/src/main/java/org/flyve/mdm/agent/utils/MQTTHelper.java @@ -47,6 +47,7 @@ import org.json.JSONObject; import java.util.ArrayList; +import java.util.Arrays; public class MQTTHelper { @@ -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; } @@ -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); @@ -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()));