diff --git a/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java b/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java index 87fa616e..bc6d1d7b 100644 --- a/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java +++ b/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java @@ -104,7 +104,13 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements L @ReactMethod public void cancelAllLocalNotifications() { - mRNFirebaseLocalMessagingHelper.cancelAllLocalNotifications(); + try { + mRNFirebaseLocalMessagingHelper.cancelAllLocalNotifications(); + } catch (SecurityException e) { + // In some devices/situations cancelAllLocalNotifications will throw a SecurityException + // We can safely ignore this error for now as the UX impact of this not working is minor. + Log.w(TAG, e.getMessage()); + } } @ReactMethod