Skip to content

Commit

Permalink
Fix #303 - Error: java.lang.SecurityException when registering a rece…
Browse files Browse the repository at this point in the history
…iver - Android 14
  • Loading branch information
fcaldarelli committed Oct 19, 2023
1 parent 2531333 commit 2554c32
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,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.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_EXPORTED);
}else{
appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
future = scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Expand Down

0 comments on commit 2554c32

Please sign in to comment.