zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.77k stars 2.05k forks source link

Missing permission android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS #2383

Open TulioMeran opened 1 year ago

TulioMeran commented 1 year ago

Bug

When i run ./gradlew build i'm getting this error:

image

React native version: 0.72.4 React-native-push-notification: 8.1.1

WhereareUmylove commented 1 year ago

same

ErnestPG commented 1 year ago

This is a permission available only for system apps. I don't understand why it's used.

The only way I found for compile is to avoid the compilation for the line referencing this permission.

Inside the source code of the module, navigate to -> src\main\java\com\dieam\reactnativepushnotifications\modules\RNPushNotificationActions.java

before ln 65, add this comment:

      //noinspection MissingPermission  <---add this comment
      context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

Hope this helps, at least for compiling, i have not tested yet what happens when I send a notification after this...

vipulgupta27 commented 1 year ago

any update on this issue ?

mabc21 commented 12 months ago

I am also experiencing the same issue

bond-it commented 11 months ago

I found workaround. I commented line in file com.dieam.reactnativepushnotification.modules.RNPushNotificationActions: // context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

Maybe better approach is using this line only for android below 12:

if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.S) {
       //noinspection MissingPermission
       context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}
mod-thr commented 3 months ago

I found workaround. I commented line in file com.dieam.reactnativepushnotification.modules.RNPushNotificationActions: // context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

Maybe better approach is using this line only for android below 12:

if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.S) {
       //noinspection MissingPermission
       context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
}

Is there any better solution to fix this issue? i have the same problem with RN 0.74 and RNPN 8.1.1

gideon-uiby commented 1 month ago

Fix this!