Skip to content

Commit

Permalink
Support for Android 14 (RUpgradeService.java)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsNeruno committed Oct 17, 2023
1 parent a6fec0e commit adf6293
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ public void onLost(Network network) {
} else {
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
}
registerReceiver(actionReceiver, filter);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(actionReceiver, filter, Context.RECEIVER_EXPORTED);
} else {
registerReceiver(actionReceiver, filter);
}
}

private void handleNetworkChange(boolean isConnected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,11 @@ public UpgradeManager(Context context, MethodChannel channel, DownloadPermission
filter.addAction(UpgradeManager.DOWNLOAD_INSTALL);
downloadReceiver = createBroadcastReceiver();
final int sdkInt = Build.VERSION.SDK_INT;
if (sdkInt >= Build.VERSION_CODES.O) {
if (sdkInt >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(downloadReceiver, filter, Context.RECEIVER_EXPORTED);
return;
}
if (sdkInt >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(downloadReceiver, filter, Context.RECEIVER_EXPORTED);
} else {
registerReceiver(downloadReceiver, filter);
}
registerReceiver(downloadReceiver, filter);
}

public void upgrade(final String url, final Map<String, String> header, final String apkName, final Integer notificationVisibility, Integer notificationStyle, Integer installType, Boolean useDownloadManager, final Integer upgradeFlavor, final MethodChannel.Result result) {
Expand Down

0 comments on commit adf6293

Please sign in to comment.