diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java index f527892378..15d8fe5b5d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastDeviceStatus.java @@ -31,15 +31,18 @@ public class BroadcastDeviceStatus { log.debug("DEVICESTATUS " + x.size() + " receivers"); } public static void handleNewDeviceStatus(JSONArray statuses, Context context, boolean isDelta) { - Bundle bundle = new Bundle(); - bundle.putString("devicestatuses", statuses.toString()); - bundle.putBoolean("delta", isDelta); - Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); - intent.putExtras(bundle); - intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - context.sendBroadcast(intent); - List x = context.getPackageManager().queryBroadcastReceivers(intent, 0); + List splitted = BroadcastTreatment.splitArray(statuses); + for (JSONArray part: splitted) { + Bundle bundle = new Bundle(); + bundle.putString("devicestatuses", part.toString()); + bundle.putBoolean("delta", isDelta); + Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + context.sendBroadcast(intent); + List x = context.getPackageManager().queryBroadcastReceivers(intent, 0); - log.debug("DEVICESTATUS " + x.size() + " receivers"); + log.debug("DEVICESTATUS " + part.length() + " records " + x.size() + " receivers"); + } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java index 3b76d5742b..382d8734dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/broadcasts/BroadcastTreatment.java @@ -114,7 +114,7 @@ public class BroadcastTreatment { } - private static List splitArray(JSONArray array) { + public static List splitArray(JSONArray array) { List ret = new ArrayList<>(); try { int size = array.length();