From 032b2f5611ac4f766c4896117f40395c6d464be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Katzer?= Date: Fri, 28 Feb 2014 17:10:07 +0100 Subject: [PATCH] `isServiceAvailable` on Android did not return a list of available printing apps (fix for #6) --- README.md | 3 +++ plugin.xml | 2 -- src/android/Printer.java | 12 +++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aa7248c..baa8550 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ cordova plugin rm de.appplant.cordova.plugin.printer ``` ## Release Notes +#### Version 0.5.2 (not yet released) +- [bugfix:] `isServiceAvailable` on Android did not return a list of available printing apps. + #### Version 0.5.1 (15.12.2013) - Removed Android KitKat support *(See kitkat branch)* diff --git a/plugin.xml b/plugin.xml index a80ee8b..af4711b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -27,7 +27,6 @@ - @@ -36,7 +35,6 @@ - diff --git a/src/android/Printer.java b/src/android/Printer.java index 7c6d1b4..356d383 100644 --- a/src/android/Printer.java +++ b/src/android/Printer.java @@ -108,9 +108,15 @@ public class Printer extends CordovaPlugin { * Überprüft, ob ein Drucker zur Verfügung steht. */ private void isServiceAvailable (CallbackContext ctx) { - JSONArray appIds = this.getInstalledAppIds(); - Boolean available = appIds.length() > 0; - PluginResult result = new PluginResult(PluginResult.Status.OK, available); + JSONArray appIds = this.getInstalledAppIds(); + Boolean available = appIds.length() > 0; + JSONArray args = new JSONArray(); + PluginResult result; + + args.put(available); + args.put(appIds); + + result = new PluginResult(PluginResult.Status.OK, args); ctx.sendPluginResult(result); }