This commit is contained in:
Jerry Yan 2020-03-14 17:51:21 +08:00
parent 7836530c27
commit b6f600e708

View File

@ -8,6 +8,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
@ -120,7 +121,7 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
byte[] buffer = new byte[2048];
int len = 0;
long total = response.body().contentLength();
File file = new File("update.apk");
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),"update.apk");
fileOutputStream = new FileOutputStream(file);
long sum = 0;
while ((len = stream.read(buffer)) != -1) {