From 652c6c62c26892011e28bedcea5aee69da005f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Mon, 28 Jan 2019 11:05:26 +0100 Subject: [PATCH] Pick() is only supported on iOS platform --- www/printer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/www/printer.js b/www/printer.js index ef0cb3d..c0f71ab 100755 --- a/www/printer.js +++ b/www/printer.js @@ -17,7 +17,9 @@ under the License. */ -var exec = require('cordova/exec'); +var exec = require('cordova/exec'), + ua = navigator.userAgent.toLowerCase(), + isIOS = ua.indexOf('ipad') > -1 || ua.indexOf('iphone') > -1; // Defaults exports._defaults = { @@ -141,7 +143,11 @@ exports.pick = function (options, callback, scope) { var fn = this._createCallbackFn(callback, scope), params = this._mergeWithDefaults(options || {}); - exec(fn, null, 'Printer', 'pick', [params]); + if (isIOS) { + exec(fn, null, 'Printer', 'pick', [params]); + } else if (fn) { + fn(null); + } }; /**