PageSourceSearch

https://reactnative.dev/assets/js/f7f3ae6c.ccdeadbe.js

js reactnative.dev collected 2026-09-24 07:15:44 UTC 39,401 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkreact_native_website=self.webpackChunkreact_native_website||[]).push([["11493"],{38489(e,i,n){n.r(i),n.d(i,{metadata:()=>t,default:()=>h,frontMatter:()=>c,contentTitle:()=>r,toc:()=>a,assets:()=>l});var t=JSON.parse('{"id":"pushnotificationios","title":"\u{1F5D1}\uFE0F PushNotificationIOS","description":"Deprecated. Use the community package instead.","source":"@site/versioned_docs/version-0.80/pushnotificationios.md","sourceDirName":".","slug":"/pushnotificationios","permalink":"/docs/0.80/pushnotificationios","draft":false,"unlisted":false,"editUrl":"[{\\"label\\":\\"Edit page for next release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/docs/pushnotificationios.md\\"},{\\"label\\":\\"Edit page for 0.80 release\\",\\"href\\":\\"https://github.com/facebook/react-native-website/edit/main/website/versioned_docs/version-0.80/pushnotificationios.md\\"}]","tags":[],"version":"0.80","lastUpdatedAt":1757518175000,"frontMatter":{"id":"pushnotificationios","title":"\u{1F5D1}\uFE0F PushNotificationIOS"}}'),s=n(62540),o=n(43023);let c={id:"pushnotificationios",title:"\u{1F5D1}\uFE0F PushNotificationIOS"},r,l={},a=[{value:"Getting Started",id:"getting-started",level:2},{value:"Enable support for <code>register</code> events",id:"enable-support-for-register-events",level:3},{value:"Handle notifications",id:"handle-notifications",level:3},{value:"Foreground notifications",id:"foreground-notifications",level:4},{value:"Background notifications",id:"background-notifications",level:4},{value:"Methods",id:"methods",level:2},{value:"<code>presentLocalNotification()</code>",id:"presentlocalnotification",level:3},{value:"<code>scheduleLocalNotification()</code>",id:"schedulelocalnotification",level:3},{value:"<code>cancelAllLocalNotifications()</code>",id:"cancelalllocalnotifications",level:3},{value:"<code>removeAllDeliveredNotifications()</code>",id:"removealldeliverednotifications",level:3},{value:"<code>getDeliveredNotifications()</code>",id:"getdeliverednotifications",level:3},{value:"<code>removeDeliveredNotifications()</code>",id:"removedeliverednotifications",level:3},{value:"<code>setApplicationIconBadgeNumber()</code>",id:"setapplicationiconbadgenumber",level:3},{value:"<code>getApplicationIconBadgeNumber()</code>",id:"getapplicationiconbadgenumber",level:3},{value:"<code>cancelLocalNotifications()</code>",id:"cancellocalnotifications",level:3},{value:"<code>getScheduledLocalNotifications()</code>",id:"getscheduledlocalnotifications",level:3},{value:"<code>addEventListener()</code>",id:"addeventlistener",level:3},{value:"<code>removeEventListener()</code>",id:"removeeventlistener",level:3},{value:"<code>requestPermissions()</code>",id:"requestpermissions",level:3},{value:"<code>abandonPermissions()</code>",id:"abandonpermissions",level:3},{value:"<code>checkPermissions()</code>",id:"checkpermissions",level:3},{value:"<code>getInitialNotification()</code>",id:"getinitialnotification",level:3},{value:"<code>getAuthorizationStatus()</code>",id:"getauthorizationstatus",level:3},{value:"<code>finish()</code>",id:"finish",level:3},{value:"<code>getMessage()</code>",id:"getmessage",level:3},{value:"<code>getSound()</code>",id:"getsound",level:3},{value:"<code>getCategory()</code>",id:"getcategory",level:3},{value:"<code>getAlert()</code>",id:"getalert",level:3},{value:"<code>getContentAvailable()</code>",id:"getcontentavailable",level:3},{value:"<code>getBadgeCount()</code>",id:"getbadgecount",level:3},{value:"<code>getData()</code>",id:"getdata",level:3},{value:"<code>getThreadID()</code>",id:"getthreadid",level:3}];function d(e){let i={a:"a",blockquote:"blockquote",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i.blockquote,{children:["\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.strong,{children:"Deprecated."})," Use the ",(0,s.jsx)(i.a,{href:"https://github.com/react-native-push-notification/ios",children:"community package"})," instead."]}),"\n"]}),"\n",(0,s.jsxs)("div",{className:"banner-native-code-required",children:[(0,s.jsx)("h3",{children:"Projects with Native Code Only"}),(0,s.jsxs)("p",{children:["The following section only applies to projects with native code exposed. If you are using the managed Expo workflow, see the guide on ",(0,s.jsx)("a",{href:"https://docs.expo.dev/versions/latest/sdk/notifications/",children:"Notifications"})," in the Expo documentation for the appropriate alternative."]})]}),"\n",(0,s.jsx)(i.p,{children:"Handle notifications for your app, including scheduling and permissions."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h2,{id:"getting-started",children:"Getting Started"}),"\n",(0,s.jsxs)(i.p,{children:["To enable push notifications, ",(0,s.jsx)(i.a,{href:"https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server",children:"configure your notifications with Apple"})," and your server-side system."]}),"\n",(0,s.jsxs)(i.p,{children:["Then, ",(0,s.jsx)(i.a,{href:"https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/
1pushing_background_updates_to_your_app#2980038",children:"enable remote notifications"})," in your project. This will automatically enable the required settings."]}),"\n",(0,s.jsxs)(i.h3,{id:"enable-support-for-register-events",children:["Enable support for ",(0,s.jsx)(i.code,{children:"register"})," events"]}),"\n",(0,s.jsxs)(i.p,{children:["In your ",(0,s.jsx)(i.code,{children:"AppDelegate.m"}),", add:"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"#import <React/RCTPushNotificationManager.h>\n"})}),"\n",(0,s.jsx)(i.p,{children:"Then implement the following in order to handle remote notification registration events:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken\n{\n // This will trigger 'register' events on PushNotificationIOS\n [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n}\n- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error\n{\n // This will trigger 'registrationError' events on PushNotificationIOS\n [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];\n}\n"})}),"\n",(0,s.jsx)(i.h3,{id:"handle-notifications",children:"Handle notifications"}),"\n",(0,s.jsxs)(i.p,{children:["You'll need to implement ",(0,s.jsx)(i.code,{children:"UNUserNotificationCenterDelegate"})," in your ",(0,s.jsx)(i.code,{children:"AppDelegate"}),":"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"#import <UserNotifications/UserNotifications.h>\n\n@interface YourAppDelegate () <UNUserNotificationCenterDelegate>\n@end\n"})}),"\n",(0,s.jsx)(i.p,{children:"Set the delegate on app launch:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n  ...\n  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];\n  center.delegate = self;\n\n  return YES;\n}\n"})}),"\n",(0,s.jsx)(i.h4,{id:"foreground-notifications",children:"Foreground notifications"}),"\n",(0,s.jsxs)(i.p,{children:["Implement ",(0,s.jsx)(i.code,{children:"userNotificationCenter:willPresentNotification:withCompletionHandler:"})," to handle notifications that arrive when the app is in the foreground. Use the completionHandler to determine if the notification will be shown to the user and notify ",(0,s.jsx)(i.code,{children:"RCTPushNotificationManager"})," accordingly:"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"// Called when a notification is delivered to a foreground app.\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\n       willPresentNotification:(UNNotification *)notification\n         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler\n{\n  // This will trigger 'notification' and 'localNotification' events on PushNotificationIOS\n  [RCTPushNotificationManager didReceiveNotification:notification];\n  // Decide if and how the notification will be shown to the user\n  completionHandler(UNNotificationPresentationOptionNone);\n}\n"})}),"\n",(0,s.jsx)(i.h4,{id:"background-notifications",children:"Backgroun
1d notifications"}),"\n",(0,s.jsxs)(i.p,{children:["Implement ",(0,s.jsx)(i.code,{children:"userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:"})," to handle when a notification is tapped, typically called for background notifications which the user taps to open the app. However, if you had set foreground notifications to be shown in ",(0,s.jsx)(i.code,{children:"userNotificationCenter:willPresentNotification:withCompletionHandler:"}),", this method will also be invoked on foreground notifications when tapped. In this case, you should only notify ",(0,s.jsx)(i.code,{children:"RCTPushNotificationManager"})," in one of these callbacks."]}),"\n",(0,s.jsxs)(i.p,{children:["If the tapped notification resulted in app launch, call ",(0,s.jsx)(i.code,{children:"setInitialNotification:"}),". If the notification was not previously handled by ",(0,s.jsx)(i.code,{children:"userNotificationCenter:willPresentNotification:withCompletionHandler:"}),", call ",(0,s.jsx)(i.code,{children:"didReceiveNotification:"})," as well:"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"- (void)  userNotificationCenter:(UNUserNotificationCenter *)center\n  didReceiveNotificationResponse:(UNNotificationResponse *)response\n           withCompletionHandler:(void (^)(void))completionHandler\n{\n  // This condition passes if the notification was tapped to launch the app\n  if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) {\n    // Allow the notification to be retrieved on the JS side using getInitialNotification()\n    [RCTPushNotificationManager setInitialNotification:response.notification];\n  }\n  // This will trigger 'notification' and 'localNotification' events on PushNotificationIOS\n  [RCTPushNotificationManager didReceiveNotification:response.notification];\n  completionHandler();\n}\n"})}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h1,{id:"reference",children:"Reference"}),"\n",(0,s.jsx)(i.h2,{id:"methods",children:"Methods"}),"\n",(0,s.jsx)(i.h3,{id:"presentlocalnotification",children:(0,s.jsx)(i.code,{children:"presentLocalNotification()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static presentLocalNotification(details: PresentLocalNotificationDetails);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Schedules a local notification for immediate presentation."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"details"}),(0,s.jsx)(i.td,{children:"object"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"See below."})]})})]}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.code,{children:"details"}
1)," is an object containing:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertTitle"})," : The text displayed as the title of the notification alert."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertBody"})," : The message displayed in the notification alert."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"userInfo"})," : An object containing additional notification data (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"category"})," : The category of this notification, required for actionable notifications (optional). e.g. notifications with additional actions such as Reply or Like."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"applicationIconBadgeNumber"})," The number to display as the app's icon badge. The default value of this property is 0, which means that no badge is displayed (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"isSilent"})," : If true, the notification will appear without sound (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"soundName"})," : The sound played when the notification is fired (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertAction"})," : DEPRECATED. This was used for iOS's legacy UILocalNotification."]}),"\n"]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"schedulelocalnotification",children:(0,s.jsx)(i.code,{children:"scheduleLocalNotification()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static scheduleLocalNotification(details: ScheduleLocalNotificationDetails);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Schedules a local notification for future presentation."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"details"}),(0,s.jsx)(i.td,{children:"object"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"See below."})]})})]}),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.code,{children:"details"}
1)," is an object containing:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertTitle"})," : The text displayed as the title of the notification alert."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertBody"})," : The message displayed in the notification alert."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"fireDate"})," : When the notification will be fired. Schedule notifications using either ",(0,s.jsx)(i.code,{children:"fireDate"})," or ",(0,s.jsx)(i.code,{children:"fireIntervalSeconds"}),", with ",(0,s.jsx)(i.code,{children:"fireDate"})," taking precedence."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"fireIntervalSeconds"})," : Seconds from now to display the notification."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"userInfo"})," : An object containing additional notification data (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"category"})," : The category of this notification, required for actionable notifications (optional). e.g. notifications with additional actions such as Reply or Like."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"applicationIconBadgeNumber"})," The number to display as the app's icon badge. The default value of this property is 0, which means that no badge is displayed (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"isSilent"})," : If true, the notification will appear without sound (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"soundName"})," : The sound played when the notification is fired (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"alertAction"})," : DEPRECATED. This was used for iOS's legacy UILocalNotification."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"repeatInterval"})," : DEPRECATED. Use ",(0,s.jsx)(i.code,{children:"fireDate"})," or ",(0,s.jsx)(i.code,{children:"fireIntervalSeconds"})," instead."]}),"\n"]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"cancelalllocalnotifications",children:(0,s.jsx)(i.code,{children:"cancelAllLocalNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static cancelAllLocalNotifications();\n"})}),"\n",(0,s.jsx)(i.p,{children:"Cancels all scheduled local notifications."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"removealldeliverednotifications",children:(0,s.jsx)(i.code,{children:"removeAllDeliveredNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static removeAllDeliveredNotifications();\n"})}),"\n",(0,s.jsx)(i.p,{children:"Removes all delivered notifications from Notification Center."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getdeliverednotifications",children:(0,s.jsx)(i.code,{children:"getDeliveredNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static getDeliveredNotifications(callback: (notifications: Object[]) => void);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Provides a list of the app\u2019s notifications that are currently displayed in Notification Center."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"callback"}),(0,s.jsx)(i.td,{children:"function"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Function which receives an array of delivered notifications."})]})})]}),"\n",(0,s.jsx)(i.p,{children:"A delivered notification is an object c
1ontaining:"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"identifier"})," : The identifier of this notification."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"title"})," : The title of this notification."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"body"})," : The body of this notification."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"category"})," : The category of this notification (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"userInfo"})," : An object containing additional notification data (optional)."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"thread-id"})," : The thread identifier of this notification, if it has one."]}),"\n"]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"removedeliverednotifications",children:(0,s.jsx)(i.code,{children:"removeDeliveredNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static removeDeliveredNotifications(identifiers: string[]);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Removes the specified notifications from Notification Center."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"identifiers"}),(0,s.jsx)(i.td,{children:"array"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Array of notification identifiers."})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"setapplicationiconbadgenumber",children:(0,s.jsx)(i.code,{children:"setApplicationIconBadgeNumber()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static setApplicationIconBadgeNumber(num: number);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Sets the badge number for the app icon on the Home Screen."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"number"}),(0,s.jsx)(i.td,{children:"number"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Badge number for the app icon."})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getapplicationiconbadgenumber",children:(0,s.jsx)(i.code,{children:"getApplicationIconBadgeNumber()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static getApplicationIconBadgeNumber(callback: (num: number) => void);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Gets the current badge number for the app icon on the Home Screen."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"callback"}),(0,s.jsx)(i.td,{children:"function"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Function which processes the current badge number."})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"cancellocalnotifications",children:(0,s.jsx)(i.code,{children:"cancelLocalNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static cancelLocalNotifications(userInfo: Object);\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Cancels any scheduled local notifications which match the fields in the provided ",(0,s.jsx)(i.co
1de,{children:"userInfo"}),"."]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"userInfo"}),(0,s.jsx)(i.td,{children:"object"}),(0,s.jsx)(i.td,{children:"No"}),(0,s.jsx)(i.td,{})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getscheduledlocalnotifications",children:(0,s.jsx)(i.code,{children:"getScheduledLocalNotifications()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static getScheduledLocalNotifications(\n  callback: (notifications: ScheduleLocalNotificationDetails[]) => void,\n);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Gets the list of local notifications that are currently scheduled."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"callback"}),(0,s.jsx)(i.td,{children:"function"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Function which processes an array of objects describing local notifications."})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"addeventlistener",children:(0,s.jsx)(i.code,{children:"addEventListener()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static addEventListener(\n  type: PushNotificationEventName,\n  handler:\n    | ((notification: PushNotification) => void)\n    | ((deviceToken: string) => void)\n    | ((error: {message: string; code: number; details: any}) => void),\n);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Attaches a listener to notification events including local notifications, remote notifications, and notification registration results."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsxs)(i.tbody,{children:[(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"type"}),(0,s.jsx)(i.td,{children:"string"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Event type to listen to. See below."})]}),(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"handler"}),(0,s.jsx)(i.td,{children:"function"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"Listener."})]})]})]}),"\n",(0,s.jsx)(i.p,{children:"Valid events types include:"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"notification"})," : Fired when a remote notification is received. The handler will be invoked with an instance of ",(0,s.jsx)(i.code,{children:"PushNotificationIOS"}),". This will handle notifications that arrive in the foreground or were tapped to open the app from the background."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"localNotification"})," : Fired when a local notification is received. The handler will be invoked with an instance of ",(0,s.jsx)(i.code,{children:"PushNotificationIOS"}),". This will handle notifications that arrive in the foreground or were tapped to open the app from the background."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"register"}),": Fired when the user registers successfully for remote notifications. The handler will be invoked with a hex string representing the deviceToken."]}),"\n",(0,s.jsxs)(i.li,{children:[(0,s.jsx)(i.code,{children:"registrationError"}),": Fired when the user fails to register for remote notifications. Typically occurs due to APNS issues or if the device is a simulator. The handler will be invoked with ",(0,s.jsx)(i.co
1de,{children:"{message: string, code: number, details: any}"}),"."]}),"\n"]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"removeeventlistener",children:(0,s.jsx)(i.code,{children:"removeEventListener()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static removeEventListener(\n  type: PushNotificationEventName,\n);\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Removes the event listener. Do this in ",(0,s.jsx)(i.code,{children:"componentWillUnmount"})," to prevent memory leaks."]}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"type"}),(0,s.jsx)(i.td,{children:"string"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsxs)(i.td,{children:["Event type. See ",(0,s.jsx)(i.code,{children:"addEventListener()"})," for options."]})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"requestpermissions",children:(0,s.jsx)(i.code,{children:"requestPermissions()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static requestPermissions(permissions?: PushNotificationPermissions[]);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Requests notification permissions from iOS, prompting the user with a dialog box. By default, this will request all notification permissions, but you can optionally specify which permissions to request. The following permissions are supported:"}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"alert"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"badge"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"sound"})}),"\n"]}),"\n",(0,s.jsx)(i.p,{children:"If a map is provided to the method, only the permissions with truthy values will be requested."}),"\n",(0,s.jsx)(i.p,{children:"This method returns a promise that will resolve when the user accepts or rejects the request, or if the permissions were previously rejected. The promise resolves to the state of the permissions after the request has been completed."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"permissions"}),(0,s.jsx)(i.td,{children:"array"}),(0,s.jsx)(i.td,{children:"No"}),(0,s.jsx)(i.td,{children:"alert, badge, or sound"})]})})]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"abandonpermissions",children:(0,s.jsx)(i.code,{children:"abandonPermissions()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static abandonPermissions();\n"})}),"\n",(0,s.jsx)(i.p,{children:"Unregister for all remote notifications received via Apple Push Notification service."}),"\n",(0,s.jsx)(i.p,{children:"You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Settings app. Apps unregistered through this method can always re-register."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"checkpermissions",children:(0,s.jsx)(i.code,{children:"checkPermissions()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static checkPermissions(\n  callback: (permissions: PushNotificationPermissions) => void,\n);\n"})}),"\n",(0,s.jsx)(i.p,{children:"Check which push permissions are currently enabled."}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.strong,{children:"Parameters:"})}),"\n",(0,s.jsxs)(i.table,{children:[(0,s.jsx)(i.thead,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.th,{children:"Name"}),(0,s.jsx)(i.th,{children:"Type"}),(0,s.jsx)(i.th,{children:"Required"}),(0,s.jsx)(i.th,{children:"Description"})]})}),(0,s.jsx)(i.tbody,{children:(0,s.jsxs)(i.tr,{children:[(0,s.jsx)(i.td,{children:"callback"}),(0,s.jsx)(i.td,{children:"function"}),(0,s.jsx)(i.td,{children:"Yes"}),(0,s.jsx)(i.td,{children:"See below."})]})})]}
1),"\n",(0,s.jsxs)(i.p,{children:[(0,s.jsx)(i.code,{children:"callback"})," will be invoked with a ",(0,s.jsx)(i.code,{children:"permissions"})," object:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"alert: boolean"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"badge: boolean"})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.code,{children:"sound: boolean"})}),"\n"]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getinitialnotification",children:(0,s.jsx)(i.code,{children:"getInitialNotification()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static getInitialNotification(): Promise<PushNotification | null>;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type ",(0,s.jsx)(i.code,{children:"PushNotificationIOS"})," for the notification that was tapped. Otherwise, it resolves to ",(0,s.jsx)(i.code,{children:"null"}),"."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getauthorizationstatus",children:(0,s.jsx)(i.code,{children:"getAuthorizationStatus()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"static getAuthorizationStatus(): Promise<number>;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["This method returns a promise that resolves to the current notification authorization status. See ",(0,s.jsx)(i.a,{href:"https://developer.apple.com/documentation/usernotifications/unauthorizationstatus?language=objc",children:"UNAuthorizationStatus"})," for possible values."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"finish",children:(0,s.jsx)(i.code,{children:"finish()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"finish(result: string);\n"})}),"\n",(0,s.jsxs)(i.p,{children:["This method is available for remote notifications that have been received via ",(0,s.jsx)(i.a,{href:"https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application?language=objc",children:(0,s.jsx)(i.code,{children:"application:didReceiveRemoteNotification:fetchCompletionHandler:"})}),". However, this is superseded by ",(0,s.jsx)(i.code,{children:"UNUserNotificationCenterDelegate"})," and will no longer be invoked if both ",(0,s.jsx)(i.code,{children:"application:didReceiveRemoteNotification:fetchCompletionHandler:"})," and the newer handlers from ",(0,s.jsx)(i.code,{children:"UNUserNotificationCenterDelegate"})," are implemented."]}),"\n",(0,s.jsxs)(i.p,{children:["If for some reason you're still relying on ",(0,s.jsx)(i.code,{children:"application:didReceiveRemoteNotification:fetchCompletionHandler:"}),", you'll need to set up event handling on the iOS side:"]}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-objectivec",metastring:'title="Objective-C"',children:"- (void)           application:(UIApplication *)application\n  didReceiveRemoteNotification:(NSDictionary *)userInfo\n        fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler\n{\n  [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:handler];\n}\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Call ",(0,s.jsx)(i.code,{children:"finish()"})," to execute the native completion handlers once you're done handling the notification on the JS side. When calling this block, pass in the fetch result value that best describes the results of your operation. For a list of possible values, see ",(0,s.jsx)(i.code,{children:"PushNotificationIOS.FetchResult"}),"."]}),"\n",(0,s.jsxs)(i.p,{children:["If you're using ",(0,s.jsx)(i.code,{children:"application:didReceiveRemoteNotification:fetchCompletionHandler:"}),", you ",(0,s.jsx)(i.em,{children:"must"})," call this handler and should do so as soon as possible. See the ",(0,s.jsx)(i.a,{href:"https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application?language=objc",children:"official documentation"})," for more details."]}),"\n",(0,s.jsx)(i.hr,{}
1),"\n",(0,s.jsx)(i.h3,{id:"getmessage",children:(0,s.jsx)(i.code,{children:"getMessage()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getMessage(): string | Object;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["An alias for ",(0,s.jsx)(i.code,{children:"getAlert"})," to get the notification's main message string."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getsound",children:(0,s.jsx)(i.code,{children:"getSound()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getSound(): string;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Gets the sound string from the ",(0,s.jsx)(i.code,{children:"aps"})," object. This will be ",(0,s.jsx)(i.code,{children:"null"})," for local notifications."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getcategory",children:(0,s.jsx)(i.code,{children:"getCategory()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getCategory(): string;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Gets the category string from the ",(0,s.jsx)(i.code,{children:"aps"})," object."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getalert",children:(0,s.jsx)(i.code,{children:"getAlert()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getAlert(): string | Object;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Gets the notification's main message from the ",(0,s.jsx)(i.code,{children:"aps"})," object. Also see the alias: ",(0,s.jsx)(i.code,{children:"getMessage()"}),"."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getcontentavailable",children:(0,s.jsx)(i.code,{children:"getContentAvailable()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getContentAvailable(): number;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Gets the content-available number from the ",(0,s.jsx)(i.code,{children:"aps"})," object."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getbadgecount",children:(0,s.jsx)(i.code,{children:"getBadgeCount()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getBadgeCount(): number;\n"})}),"\n",(0,s.jsxs)(i.p,{children:["Gets the badge count number from the ",(0,s.jsx)(i.code,{children:"aps"})," object."]}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getdata",children:(0,s.jsx)(i.code,{children:"getData()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getData(): Object;\n"})}),"\n",(0,s.jsx)(i.p,{children:"Gets the data object on the notification."}),"\n",(0,s.jsx)(i.hr,{}),"\n",(0,s.jsx)(i.h3,{id:"getthreadid",children:(0,s.jsx)(i.code,{children:"getThreadID()"})}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-tsx",metastring:'title="React TSX"',children:"getThreadID();\n"})}),"\n",(0,s.jsx)(i.p,{children:"Gets the thread ID on the notification."})]})}function h(e={}){let{wrapper:i}={...(0,o.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},43023(e,i,n){n.d(i,{R:()=>c,x:()=>r});var t=n(63696);let s={},o=t.createContext(s);function c(e){let i=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(i):{...i,...e}},[i,e])}function r(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),t.createElement(o.Provider,{value:i},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.