Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when receiving call when targetSdkVersion is 34 #780

Closed
1 of 3 tasks
taekeun-two opened this issue May 27, 2024 · 1 comment

Comments

@taekeun-two
Copy link

taekeun-two commented May 27, 2024

Bug report

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

After upgrading

  • from: ReactNative 0.72.X and Expo 49,
  • to: ReactNative 0.73.X and Expo 50,
// android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
    }

the following error occurs whenever receiving call in Android 14 platform phone.

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified 

References

Registering receivers with intention using the RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag was introduced as part of Android 13 and is now a requirement for apps running on Android 14 or higher (U+).
It seems that it should be applied for callkeep's registering receivers.

diff --git a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
index a8abd71..efa1b46 100644
--- a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
+++ b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
@@ -196,7 +196,11 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
                 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;
             }

Steps to Reproduce

  • Upgrade to react native 0.73.8 and Expo 50.0.18
  • Receiving call in Android 14 platform phone. It always occurs.

Versions

- Callkeep: 4.3.9
- React Native: 0.73.8   // upgraded from 0.72.10
- Expo : 50.0.18         // upgraded from 49
- iOS:
- Android: Android version 14
- Phone model: Samsung Galaxy S23+ SM-S916N

Logs

java.lang.SecurityException: <packageName>: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

iScreen Shoter - Microsoft Teams - 240527101342

@taekeun-two taekeun-two changed the title One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified in Android 14 when receiving call after upgrading react native 0.73 [Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified in Android 14 when receiving call after upgrading react native 0.73 May 27, 2024
@taekeun-two taekeun-two changed the title [Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified in Android 14 when receiving call after upgrading react native 0.73 [Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when receiving call when targetSDK is 34 Jul 10, 2024
@taekeun-two taekeun-two changed the title [Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when receiving call when targetSDK is 34 [Android] One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when receiving call when targetSdkVersion is 34 Jul 10, 2024
@taekeun-two
Copy link
Author

Initially I thought that it's callkeep's code, but finally I found that the error comes from react-native-incall-manager. I'm so sorry for wrong error report.

image

In react-native-incall-manger latest v4.2.0 , this problem was fixed.

https://github.com/react-native-webrtc/react-native-incall-manager/releases/tag/4.2.0

Support Android 14 receiver changes
fix(android): specify export mode on BroadcastReceivers ( Santhosh Vaiyapuri 2024-02-16 10:41:22 +0100)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant