fix(self-updater): export receiver for android 13 and plus
This commit is contained in:
@@ -211,7 +211,13 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
|||||||
if(state==UpdateState.DOWNLOADING)
|
if(state==UpdateState.DOWNLOADING)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class);
|
DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class);
|
||||||
|
|
||||||
|
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));
|
MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||||
|
}
|
||||||
|
|
||||||
downloadID=dm.enqueue(
|
downloadID=dm.enqueue(
|
||||||
new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null)))
|
new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null)))
|
||||||
.setDestinationUri(Uri.fromFile(getUpdateApkFile()))
|
.setDestinationUri(Uri.fromFile(getUpdateApkFile()))
|
||||||
|
|||||||
@@ -206,7 +206,13 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
|||||||
if(state==UpdateState.DOWNLOADING)
|
if(state==UpdateState.DOWNLOADING)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class);
|
DownloadManager dm=MastodonApp.context.getSystemService(DownloadManager.class);
|
||||||
|
|
||||||
|
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));
|
MastodonApp.context.registerReceiver(downloadCompletionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||||
|
}
|
||||||
|
|
||||||
downloadID=dm.enqueue(
|
downloadID=dm.enqueue(
|
||||||
new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null)))
|
new DownloadManager.Request(Uri.parse(getPrefs().getString("apkURL", null)))
|
||||||
.setDestinationUri(Uri.fromFile(getUpdateApkFile()))
|
.setDestinationUri(Uri.fromFile(getUpdateApkFile()))
|
||||||
|
|||||||
Reference in New Issue
Block a user