diff --git a/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java b/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java index 73ca393d84..1cf492b5f3 100644 --- a/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java +++ b/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java @@ -211,7 +211,13 @@ public void downloadUpdate(){ if(state==UpdateState.DOWNLOADING) throw new IllegalStateException(); DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class); - MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.TIRAMISU){ + MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_EXPORTED); + }else{ + MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + } + downloadID=dm.enqueue( new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null))) .setDestinationUri(Uri.fromFile(getUpdateApkFile())) diff --git a/mastodon/src/nightly/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java b/mastodon/src/nightly/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java index dc546f21df..ed61487328 100644 --- a/mastodon/src/nightly/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java +++ b/mastodon/src/nightly/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java @@ -206,7 +206,13 @@ public void downloadUpdate(){ if(state==UpdateState.DOWNLOADING) throw new IllegalStateException(); DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class); - MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.TIRAMISU){ + MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_EXPORTED); + }else{ + MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + } + downloadID=dm.enqueue( new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null))) .setDestinationUri(Uri.fromFile(getUpdateApkFile()))