diff --git a/packages/react-native/android/src/main/java/io/invertase/notifee/NotifeeApiModule.java b/packages/react-native/android/src/main/java/io/invertase/notifee/NotifeeApiModule.java index 7ed77c1d..d57abbed 100644 --- a/packages/react-native/android/src/main/java/io/invertase/notifee/NotifeeApiModule.java +++ b/packages/react-native/android/src/main/java/io/invertase/notifee/NotifeeApiModule.java @@ -273,10 +273,17 @@ public void requestPermission(Promise promise) { .setRequestPermissionCallback( (e, aBundle) -> NotifeeReactUtils.promiseResolver(promise, e, aBundle)); - activity.requestPermissions( - new String[] {Manifest.permission.POST_NOTIFICATIONS}, - Notifee.REQUEST_CODE_NOTIFICATION_PERMISSION, - this); + try { + activity.requestPermissions( + new String[] {Manifest.permission.POST_NOTIFICATIONS}, + Notifee.REQUEST_CODE_NOTIFICATION_PERMISSION, + this); + } catch (Exception e) { + Logger.d( + "requestPermission", + "Failed to request POST_NOTIFICATIONS permission: " + e.getMessage()); + NotifeeReactUtils.promiseResolver(promise, e); + } } @ReactMethod