diff --git a/RNNotifications/RNNotifications.m b/RNNotifications/RNNotifications.m index e91494d2270f450f417cc010e9026ff7fa740305..e10edd11a914688b37dd32447f7db21d27737561 100644 --- a/RNNotifications/RNNotifications.m +++ b/RNNotifications/RNNotifications.m @@ -549,4 +549,17 @@ RCT_EXPORT_METHOD(cancelAllLocalNotifications) [RCTSharedApplication() cancelAllLocalNotifications]; } +RCT_EXPORT_METHOD(isRegisteredForRemoteNotifications:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) +{ + BOOL ans; + + if (TARGET_IPHONE_SIMULATOR) { + ans = [[[UIApplication sharedApplication] currentUserNotificationSettings] types] != 0; + } + else { + ans = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; + } + resolve(@(ans)); +} + @end