diff --git a/src/android/FileTransferBackground.java b/src/android/FileTransferBackground.java index 34a5932f..8cb6c393 100644 --- a/src/android/FileTransferBackground.java +++ b/src/android/FileTransferBackground.java @@ -121,11 +121,11 @@ private void sendError(final String id, final String reason, boolean userCancele @Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) { - if(executorService == null) { + if (executorService == null) { executorService = Executors.newScheduledThreadPool(4); } - executorService.schedule(() -> { + cordova.getThreadPool().execute(() -> { try { switch (action) { case "initManager": @@ -151,7 +151,7 @@ public boolean execute(String action, JSONArray args, final CallbackContext call callbackContext.sendPluginResult(result); exception.printStackTrace(); } - } , 0, TimeUnit.MILLISECONDS); + }); return true; }