From 5e630441973abd05d5552c7f4eafa21e98866311 Mon Sep 17 00:00:00 2001 From: shavlegkakulia <31736451+shavlegkakulia@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:22:13 +0400 Subject: [PATCH] Update RNFetchBlobReq.java on target 34 or upper there was crash. in this file "RnFetchBlobReq" 199 line there added new argument in "registerReceiver" if target is more or equal with 34. --- android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java index 55fb15c4c..c05429c1a 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java @@ -196,7 +196,11 @@ public void run() { DownloadManager dm = (DownloadManager) appCtx.getSystemService(Context.DOWNLOAD_SERVICE); downloadManagerId = dm.enqueue(req); androidDownloadManagerTaskTable.put(taskId, Long.valueOf(downloadManagerId)); - appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + if (Build.VERSION.SDK_INT >= 34 && appCtx.getApplicationInfo().targetSdkVersion >= 34) { + appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_EXPORTED); + }else{ + appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + } return; }