android: try fix ANR in onProgress method

This commit is contained in:
Kesha Antonov
2023-11-02 13:41:15 +03:00
parent 9342db0e94
commit 0090439e08

View File

@@ -405,12 +405,16 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule imp
e.printStackTrace();
}
});
try {
th.start();
th.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
new Thread(new Runnable() {
public void run() {
try {
th.start();
th.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
} else {
params.putInt("written", (int)download.getDownloaded());
params.putInt("total", (int)download.getTotal());