From 08a0a290c2a8697ce5e8ca6b6118278de83a732f Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Fri, 16 Dec 2016 10:36:47 +0530 Subject: [PATCH] Fixed : SMS Script not executing automatically. --- .../iot/android/sense/event/streams/sms/SmsDataReceiver.java | 1 - .../iot/android/sense/util/SenseDataReceiverManager.java | 1 + .../androidsense/android_sms_script/AndroidSmsScript.xml | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/sms/SmsDataReceiver.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/sms/SmsDataReceiver.java index 2ada981fb..d107ab0a9 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/sms/SmsDataReceiver.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/event/streams/sms/SmsDataReceiver.java @@ -33,7 +33,6 @@ public class SmsDataReceiver extends BroadcastReceiver { final Bundle bundle = intent.getExtras(); if (bundle != null) { - final Object[] pdusObj = (Object[]) bundle.get("pdus"); for (int i = 0; i < pdusObj.length; i++) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseDataReceiverManager.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseDataReceiverManager.java index 3442facb4..9b6c2f15b 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseDataReceiverManager.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/util/SenseDataReceiverManager.java @@ -148,6 +148,7 @@ public class SenseDataReceiverManager { smsDataReceiver = new SmsDataReceiver(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION); + intentFilter.addAction(Telephony.Sms.Intents.SMS_DELIVER_ACTION); context.registerReceiver(smsDataReceiver, intentFilter); } } diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml index fe039d028..e28337088 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sms_script/AndroidSmsScript.xml @@ -15,5 +15,7 @@ FROM AndroidSmsData GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SMS_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SMS_STATS; + + 0 0/5 * * * ?