gbumps / react-native-screenguard

A Native screenshot blocking library for React-Native developer, with background customizable after captured. Screenshot detector are also supported.
https://gbumps.github.io/react-native-screenguard/
MIT License
216 stars 26 forks source link

ContextCompat.RECEIVER_NOT_EXPORTED Compilation Error in Version 1.0.2 #72

Open crazywook opened 3 months ago

crazywook commented 3 months ago

I recently updated react-native-screenguard from version 1.0.0 to 1.0.2. After the update, I encountered a compilation error related to ContextCompat.RECEIVER_NOT_EXPORTED in the ScreenGuardColorActivity.java file. This issue did not occur in version 1.0.0.

Please let me know if there is any other recommended solution or if this can be fixed in the next release.

Thank you for your assistance.

ZouwenSB commented 3 months ago

I also have this issue, for me the fix was to pin it to 1.0.0 for now. Hope it still will be fixed

gbumps commented 3 months ago

hi @crazywook, working on it, will have a release soon.

You can also fix it yourself by opening the android folder in your current project by Android studio, and go to react-native-screenguard/java/com/screenguard/ScreenGuardColorActivity.java, line 94, and change like this:

...
 registerReceiver(closeReceiver, intentFilter, RECEIVER_NOT_EXPORTED);
...

thanks and happy hacking !

Inayat567 commented 2 weeks ago

go to react-native-screenguard/java/com/screenguard/ScreenGuardColorActivity.java, line 94, patch the package

IntentFilter intentFilter = new IntentFilter(SCREENGUARD_COLOR_ACTIVITY_CLOSE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13+
        registerReceiver(closeReceiver, intentFilter, Context.RECEIVER_NOT_EXPORTED);
    } else {
        registerReceiver(closeReceiver, intentFilter);
    }

I have fixed this issue by apply above patch