diff --git a/android/src/main/java/com/tradle/react/UdpSockets.java b/android/src/main/java/com/tradle/react/UdpSockets.java index 93693c98..a0b7c462 100644 --- a/android/src/main/java/com/tradle/react/UdpSockets.java +++ b/android/src/main/java/com/tradle/react/UdpSockets.java @@ -11,6 +11,7 @@ import android.net.wifi.WifiManager; import android.support.annotation.Nullable; import android.util.SparseArray; +import android.os.AsyncTask; import com.facebook.common.logging.FLog; import com.facebook.react.bridge.Arguments; @@ -72,7 +73,7 @@ protected void doInBackgroundGuarded(Void... params) { } mClients.clear(); } - }.execute().get(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR).get(); } catch (InterruptedException ioe) { FLog.e(TAG, "onCatalystInstanceDestroy", ioe); } catch (ExecutionException ee) { @@ -118,7 +119,7 @@ protected void doInBackgroundGuarded(Void... params) { UdpSocketClient.Builder builder = new UdpSocketClient.Builder(UdpSockets.this, UdpSockets.this); mClients.put(cId, builder.build()); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -132,7 +133,7 @@ public void bind(final Integer cId, final Integer port, final @Nullable String a protected void doInBackgroundGuarded(Void... params) { UdpSocketClient client = findClient(cId, callback); if (client == null) { - return; + return; } try { @@ -154,7 +155,7 @@ protected void doInBackgroundGuarded(Void... params) { callback.invoke(UdpErrorUtil.getError(null, ioe.getMessage())); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -201,7 +202,7 @@ protected void doInBackgroundGuarded(Void... params) { FLog.e(TAG, "addMembership", ioe); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -228,7 +229,7 @@ protected void doInBackgroundGuarded(Void... params) { } } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -256,7 +257,7 @@ protected void doInBackgroundGuarded(Void... params) { callback.invoke(UdpErrorUtil.getError(null, ioe.getMessage())); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -286,7 +287,7 @@ protected void doInBackgroundGuarded(Void... params) { mClients.remove(cId); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -309,7 +310,7 @@ protected void doInBackgroundGuarded(Void... params) { callback.invoke(UdpErrorUtil.getError(null, e.getMessage())); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -343,7 +344,7 @@ protected void doInBackgroundGuarded(Void... params) { .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("udp-" + clientID + "-data", eventParams); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /**