Files
react-native/docs/0.60/pushnotificationios.html
T
2020-12-31 14:19:18 +00:00

48 lines
83 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.66">
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="React Native Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="React Native Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-41298772-2","auto"),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41298772-2"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-41298772-2",{})</script>
<link rel="search" type="application/opensearchdescription+xml" title="React Native" href="/opensearch.xml">
<script src="https://cdn.jsdelivr.net/npm/focus-visible@5.2.0/dist/focus-visible.min.js" defer="defer"></script>
<script src="https://snack.expo.io/embed.js" defer="defer"></script><title data-react-helmet="true">PushNotificationIOS · React Native</title><meta data-react-helmet="true" property="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:image:alt" content="Image for React Native"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="0.60"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-0.60"><meta data-react-helmet="true" property="og:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" property="og:title" content="PushNotificationIOS · React Native"><meta data-react-helmet="true" name="description" content="Deprecated. Use @react-native-community/push-notification-ios instead."><meta data-react-helmet="true" property="og:description" content="Deprecated. Use @react-native-community/push-notification-ios instead."><meta data-react-helmet="true" property="og:url" content="https://reactnative.dev/docs/0.60/pushnotificationios"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link data-react-helmet="true" rel="canonical" href="https://reactnative.dev/docs/0.60/pushnotificationios"><link rel="stylesheet" href="/styles.fccefeba.css">
<link rel="stylesheet" href="/main.ca40cabd.css">
<link rel="preload" href="/styles.07d522c6.js" as="script">
<link rel="preload" href="/runtime~main.c0800141.js" as="script">
<link rel="preload" href="/main.5a3c9855.js" as="script">
<link rel="preload" href="/1.ba9ce8bd.js" as="script">
<link rel="preload" href="/2.58cb5d3d.js" as="script">
<link rel="preload" href="/1f391b9e.a824c215.js" as="script">
<link rel="preload" href="/943.8b024446.js" as="script">
<link rel="preload" href="/ae345423.971fbe80.js" as="script">
<link rel="preload" href="/17896441.0c201679.js" as="script">
<link rel="preload" href="/7e297770.6167f0ee.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/header_logo.svg" alt="React Native"><strong class="navbar__title">React Native</strong></a><div class="navbar__item dropdown dropdown--hoverable dropdown--left"><a class="navbar__item navbar__link" href="/docs/0.60/getting-started">0.60</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/next/pushnotificationios">Next</a></li><li><a class="dropdown__link" href="/docs/pushnotificationios">0.63</a></li><li><a class="dropdown__link" href="/docs/0.62/pushnotificationios">0.62</a></li><li><a class="dropdown__link" href="/docs/0.61/pushnotificationios">0.61</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/docs/0.60/pushnotificationios">0.60</a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/docs/0.60/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/0.60/components-and-apis">Components</a><a class="navbar__item navbar__link navbar__link--active" href="/docs/0.60/accessibilityinfo">API</a><a class="navbar__item navbar__link" href="/help">Community</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar-github-link" aria-label="GitHub repository"></a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_3lWe"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_gnXW">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_gnXW">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span><span class="DocSearch-Button-Key"></span><span class="DocSearch-Button-Key">K</span></button></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img class="navbar__logo" src="/img/header_logo.svg" alt="React Native"><strong class="navbar__title">React Native</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/components-and-apis">Components</a></li><li class="menu__list-item"><a class="menu__link navbar__link--active" href="/docs/0.60/accessibilityinfo">API</a></li><li class="menu__list-item"><a class="menu__link" href="/help">Community</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a role="button" class="menu__link menu__link--sublist">Versions</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/next/pushnotificationios">Next</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/pushnotificationios">0.63</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.62/pushnotificationios">0.62</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.61/pushnotificationios">0.61</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/0.60/pushnotificationios">0.60</a></li><li class="menu__list-item"><a class="menu__link" href="/versions">All versions</a></li></ul></li><li class="menu__list-item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="menu__link navbar-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_2UBv"><div class="docSidebarContainer_1hqR" role="complementary"><div class="sidebar_MSwm"><div class="menu menu--responsive menu_2hiu"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_37TU" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 32 32" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">APIs</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/accessibilityinfo">AccessibilityInfo</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/actionsheetios">ActionSheetIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/alert">Alert</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/alertios">AlertIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/animated">Animated</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/appregistry">AppRegistry</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/appstate">AppState</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/asyncstorage">AsyncStorage</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/backhandler">BackHandler</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/clipboard">Clipboard</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/datepickerandroid">DatePickerAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/dimensions">Dimensions</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/easing">Easing</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/imageeditor">ImageEditor</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/imagepickerios">ImagePickerIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/image-style-props">Image Style Props</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/interactionmanager">InteractionManager</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/keyboard">Keyboard</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/layout-props">Layout Props</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/layoutanimation">LayoutAnimation</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/linking">Linking</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/panresponder">PanResponder</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/permissionsandroid">PermissionsAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/pixelratio">PixelRatio</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/0.60/pushnotificationios">PushNotificationIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/settings">Settings</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/shadow-props">Shadow Props</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/share">Share</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/statusbarios">StatusBarIOS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/stylesheet">StyleSheet</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/systrace">Systrace</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/text-style-props">Text Style Props</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/timepickerandroid">TimePickerAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/toastandroid">ToastAndroid</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/transforms">Transforms</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/vibration">Vibration</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/0.60/view-style-props">View Style Props</a></li></ul></li></ul></div></div></div><main class="docMainContainer_1rYT"><div class="container padding-vert--lg docItemWrapper_1Hme"><div class="row"><div class="col docItemCol_2AGf"><div class="alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for React Native <strong>0.60</strong>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <strong><a href="/docs/pushnotificationios">latest version</a></strong> (0.63).</div></div><div class="docItemContainer_1tAC"><article><div><span class="badge badge--secondary">Version: 0.60</span></div><header><h1 class="docTitle_cWlf">PushNotificationIOS</h1></header><div class="markdown"><blockquote><p><strong>Deprecated.</strong> Use <a href="https://github.com/react-native-community/react-native-push-notification-ios" target="_blank" rel="noopener noreferrer">@react-native-community/push-notification-ios</a> instead.</p></blockquote><div class="banner-native-code-required"><h3>Projects with Native Code Only</h3><p>This section only applies to projects made with <code>react-native init</code>or to those made with <code>expo init</code> or Create React Native App which have since ejected. For more information about ejecting, please see the <a href="https://docs.expo.io/versions/latest/workflow/customizing/" target="_blank" rel="noopener noreferrer">guide</a> on the Expo documentation..</p></div><p>Handle push notifications for your app, including permission handling and icon badge number.</p><p>To get up and running, <a href="https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW6" target="_blank" rel="noopener noreferrer">configure your notifications with Apple</a> and your server-side system.</p><p>React Native version equal or higher than 0.60.0:</p><ul><li>Autolinking in 0.60.0 handles the linking for you!</li></ul><p>React Native versions lower than 0.60.0:</p><p>Add the PushNotificationIOS library to your Podfile: ./ios/Podfile</p><ul><li><p>CocoaPods:</p><ul><li><p>Add the PushNotificationIOS library to your Podfile: ./ios/Podfile</p><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token template-string template-punctuation string" style="color:#8dc891">`</span><span class="token template-string template-punctuation string" style="color:#8dc891">`</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">.</span><span class="token punctuation" style="color:#657b83">.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token keyword" style="color:#c5a5c5">do</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">pp</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">.</span><span class="token punctuation" style="color:#657b83">.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token constant" style="color:#5a9bcf">S</span><span class="token plain">&#x27;</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token operator" style="color:#fc929e">...</span></div></div></div></div></div></li></ul></li><li><p><a href="/docs/0.60/linking-libraries-ios#manual-linking">Manually link</a> the PushNotificationIOS library:</p><ul><li>Add the following to your Project: <code>node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj</code></li><li>Add the following to <code>Link Binary With Libraries</code>: <code>libRCTPushNotification.a</code></li></ul></li></ul><p>Finally, to enable support for <code>notification</code> and <code>register</code> events you need to augment your AppDelegate.</p><p>At the top of your <code>AppDelegate.m</code>:</p><p><code>#import &lt;React/RCTPushNotificationManager.h&gt;</code></p><p>And then in your AppDelegate implementation add the following:</p><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-objectivec codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Required to register for notifications</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didRegisterUserNotificationSettings</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIUserNotificationSettings </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">notificationSettings</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">RCTPushNotificationManager didRegisterUserNotificationSettings</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">notificationSettings</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Required for the register event.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didRegisterForRemoteNotificationsWithDeviceToken</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">NSData </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">deviceToken</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">deviceToken</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Required for the notification event. You must call the completion handler after handling the remote notification.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didReceiveRemoteNotification</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">NSDictionary </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">userInfo</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> fetchCompletionHandler</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token operator" style="color:#fc929e">^</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIBackgroundFetchResult</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">completionHandler</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">RCTPushNotificationManager didReceiveRemoteNotification</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">userInfo fetchCompletionHandler</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">completionHandler</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Required for the registrationError event.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didFailToRegisterForRemoteNotificationsWithError</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">NSError </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">error</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">error</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Required for the localNotification event.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didReceiveLocalNotification</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UILocalNotification </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">notification</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">RCTPushNotificationManager didReceiveLocalNotification</span><span class="token punctuation" style="color:#657b83">:</span><span class="token plain">notification</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">}</span></div></div></div></div></div><p>To show notifications while being in the foreground (available starting from iOS 10) add the following lines:</p><p>At the top of your <code>AppDelegate.m</code>:</p><p><code>#import &lt;UserNotifications/UserNotifications.h&gt;</code></p><p>And then in your AppDelegate implementation add the following:</p><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-objectivec codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token operator" style="color:#fc929e">-</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">BOOL</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UIApplication </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">application didFinishLaunchingWithOptions</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">NSDictionary </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">launchOptions</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">.</span><span class="token punctuation" style="color:#657b83">.</span><span class="token punctuation" style="color:#657b83">.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token comment" style="color:#93a1a1">// Define UNUserNotificationCenter</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> UNUserNotificationCenter </span><span class="token operator" style="color:#fc929e">*</span><span class="token plain">center </span><span class="token operator" style="color:#fc929e">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">UNUserNotificationCenter currentNotificationCenter</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> center</span><span class="token punctuation" style="color:#657b83">.</span><span class="token plain">delegate </span><span class="token operator" style="color:#fc929e">=</span><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">self</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token keyword" style="color:#c5a5c5">return</span><span class="token plain"> YES</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">}</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token comment" style="color:#93a1a1">//Called when a notification is delivered to a foreground app.</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token operator" style="color:#fc929e">-</span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">userNotificationCenter</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UNUserNotificationCenter </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">center willPresentNotification</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UNNotification </span><span class="token operator" style="color:#fc929e">*</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">notification withCompletionHandler</span><span class="token punctuation" style="color:#657b83">:</span><span class="token punctuation" style="color:#657b83">(</span><span class="token keyword" style="color:#c5a5c5">void</span><span class="token plain"> </span><span class="token punctuation" style="color:#657b83">(</span><span class="token operator" style="color:#fc929e">^</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UNNotificationPresentationOptions options</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">)</span><span class="token plain">completionHandler</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">{</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"> </span><span class="token function" style="color:#79b6f2">completionHandler</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">UNAuthorizationOptionSound </span><span class="token operator" style="color:#fc929e">|</span><span class="token plain"> UNAuthorizationOptionAlert </span><span class="token operator" style="color:#fc929e">|</span><span class="token plain"> UNAuthorizationOptionBadge</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span><span class="token plain"></span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token punctuation" style="color:#657b83">}</span></div></div></div></div></div><p>Then enable Background Modes/Remote notifications to be able to use remote notifications properly. The easiest way to do this is via the project settings. Navigate to Targets -&gt; Your App -&gt; Capabilities -&gt; Background Modes and check Remote notifications. This will automatically enable the required settings.</p><hr><h1><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="reference"></a>Reference<a aria-hidden="true" tabindex="-1" class="hash-link" href="#reference" title="Direct link to heading">#</a></h1><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="methods"></a>Methods<a aria-hidden="true" tabindex="-1" class="hash-link" href="#methods" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="presentlocalnotification"></a><code>presentLocalNotification()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#presentlocalnotification" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">presentLocalNotification</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">details</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Schedules the localNotification for immediate presentation.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>details</td><td>object</td><td>Yes</td><td>See below.</td></tr></tbody></table><p>details is an object containing:</p><ul><li><code>alertBody</code> : The message displayed in the notification alert.</li><li><code>alertTitle</code> : The text displayed as the title of the notification alert.</li><li><code>alertAction</code> : The &quot;action&quot; displayed beneath an actionable notification. Defaults to &quot;view&quot;;</li><li><code>soundName</code> : The sound played when the notification is fired (optional).</li><li><code>isSilent</code> : If true, the notification will appear without sound (optional).</li><li><code>category</code> : The category of this notification, required for actionable notifications (optional).</li><li><code>userInfo</code> : An optional object containing additional notification data.</li><li><code>applicationIconBadgeNumber</code> (optional) : The number to display as the app&#x27;s icon badge. The default value of this property is 0, which means that no badge is displayed.</li></ul><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="schedulelocalnotification"></a><code>scheduleLocalNotification()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#schedulelocalnotification" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">scheduleLocalNotification</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">details</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Schedules the localNotification for future presentation.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>details</td><td>object</td><td>Yes</td><td>See below.</td></tr></tbody></table><p>details is an object containing:</p><ul><li><code>fireDate</code> : The date and time when the system should deliver the notification.</li><li><code>alertTitle</code> : The text displayed as the title of the notification alert.</li><li><code>alertBody</code> : The message displayed in the notification alert.</li><li><code>alertAction</code> : The &quot;action&quot; displayed beneath an actionable notification. Defaults to &quot;view&quot;;</li><li><code>soundName</code> : The sound played when the notification is fired (optional).</li><li><code>isSilent</code> : If true, the notification will appear without sound (optional).</li><li><code>category</code> : The category of this notification, required for actionable notifications (optional).</li><li><code>userInfo</code> : An optional object containing additional notification data.</li><li><code>applicationIconBadgeNumber</code> (optional) : The number to display as the app&#x27;s icon badge. Setting the number to 0 removes the icon badge.</li><li><code>repeatInterval</code> : The interval to repeat as a string. Possible values: <code>minute</code>, <code>hour</code>, <code>day</code>, <code>week</code>, <code>month</code>, <code>year</code>.</li></ul><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="cancelalllocalnotifications"></a><code>cancelAllLocalNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#cancelalllocalnotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">cancelAllLocalNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Cancels all scheduled localNotifications</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="removealldeliverednotifications"></a><code>removeAllDeliveredNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#removealldeliverednotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">removeAllDeliveredNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Remove all delivered notifications from Notification Center</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getdeliverednotifications"></a><code>getDeliveredNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getdeliverednotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">getDeliveredNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">callback</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Provides you with a list of the apps notifications that are still displayed in Notification Center</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>callback</td><td>function</td><td>Yes</td><td>Function which receive an array of delivered notifications.</td></tr></tbody></table><p>A delivered notification is an object containing:</p><ul><li><code>identifier</code> : The identifier of this notification.</li><li><code>title</code> : The title of this notification.</li><li><code>body</code> : The body of this notification.</li><li><code>category</code> : The category of this notification, if has one.</li><li><code>userInfo</code> : An optional object containing additional notification data.</li><li><code>thread-id</code> : The thread identifier of this notification, if has one.</li></ul><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="removedeliverednotifications"></a><code>removeDeliveredNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#removedeliverednotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">removeDeliveredNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">identifiers</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Removes the specified notifications from Notification Center</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>identifiers</td><td>array</td><td>Yes</td><td>Array of notification identifiers.</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="setapplicationiconbadgenumber"></a><code>setApplicationIconBadgeNumber()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#setapplicationiconbadgenumber" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">setApplicationIconBadgeNumber</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">number</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Sets the badge number for the app icon on the home screen</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>number</td><td>Yes</td><td>Badge number for the app icon.</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getapplicationiconbadgenumber"></a><code>getApplicationIconBadgeNumber()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getapplicationiconbadgenumber" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">getApplicationIconBadgeNumber</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">callback</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the current badge number for the app icon on the home screen</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>callback</td><td>function</td><td>Yes</td><td>A function that will be passed the current badge number.</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="cancellocalnotifications"></a><code>cancelLocalNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#cancellocalnotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">cancelLocalNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">userInfo</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Cancel local notifications.</p><p>Optionally restricts the set of canceled notifications to those notifications whose <code>userInfo</code> fields match the corresponding fields in the <code>userInfo</code> argument.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>userInfo</td><td>object</td><td>No</td><td></td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getscheduledlocalnotifications"></a><code>getScheduledLocalNotifications()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getscheduledlocalnotifications" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">getScheduledLocalNotifications</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">callback</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the local notifications that are currently scheduled.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>callback</td><td>function</td><td>Yes</td><td>A function that will be passed an array of objects describing local notifications.</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="addeventlistener"></a><code>addEventListener()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#addeventlistener" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">addEventListener</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">type</span><span class="token punctuation" style="color:#657b83">,</span><span class="token plain"> handler</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Attaches a listener to remote or local notification events while the app is running in the foreground or the background.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>string</td><td>Yes</td><td>Event type.</td></tr><tr><td>handler</td><td>function</td><td>Yes</td><td>Listener.</td></tr></tbody></table><p>Valid events are:</p><ul><li><code>notification</code> : Fired when a remote notification is received. The handler will be invoked with an instance of <code>PushNotificationIOS</code>.</li><li><code>localNotification</code> : Fired when a local notification is received. The handler will be invoked with an instance of <code>PushNotificationIOS</code>.</li><li><code>register</code>: Fired when the user registers for remote notifications. The handler will be invoked with a hex string representing the deviceToken.</li><li><code>registrationError</code>: Fired when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. The handler will be invoked with {message: string, code: number, details: any}.</li></ul><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="removeeventlistener"></a><code>removeEventListener()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#removeeventlistener" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">removeEventListener</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">type</span><span class="token punctuation" style="color:#657b83">,</span><span class="token plain"> handler</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Removes the event listener. Do this in <code>componentWillUnmount</code> to prevent memory leaks</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>string</td><td>Yes</td><td>Event type.</td></tr><tr><td>handler</td><td>function</td><td>Yes</td><td>Listener.</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="requestpermissions"></a><code>requestPermissions()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#requestpermissions" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">requestPermissions</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">[</span><span class="token plain">permissions</span><span class="token punctuation" style="color:#657b83">]</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Requests notification permissions from iOS, prompting the user&#x27;s dialog box. By default, it will request all notification permissions, but a subset of these can be requested by passing a map of requested permissions. The following permissions are supported:</p><ul><li><code>alert</code></li><li><code>badge</code></li><li><code>sound</code></li></ul><p>If a map is provided to the method, only the permissions with truthy values will be requested.</p><p>This method returns a promise that will resolve when the user accepts, rejects, or if the permissions were previously rejected. The promise resolves to the current state of the permission.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>permissions</td><td>array</td><td>No</td><td>alert, badge, or sound</td></tr></tbody></table><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="abandonpermissions"></a><code>abandonPermissions()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#abandonpermissions" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">abandonPermissions</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Unregister for all remote notifications received via Apple Push Notification service.</p><p>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 Notifications section of the Settings app. Apps unregistered through this method can always re-register.</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="checkpermissions"></a><code>checkPermissions()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#checkpermissions" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">checkPermissions</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">callback</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>See what push permissions are currently enabled.</p><p><strong>Parameters:</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td>callback</td><td>function</td><td>Yes</td><td>See below.</td></tr></tbody></table><p><code>callback</code> will be invoked with a <code>permissions</code> object:</p><ul><li><code>alert</code> :boolean</li><li><code>badge</code> :boolean</li><li><code>sound</code> :boolean</li></ul><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getinitialnotification"></a><code>getInitialNotification()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getinitialnotification" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">PushNotificationIOS</span><span class="token punctuation" style="color:#657b83">.</span><span class="token function" style="color:#79b6f2">getInitialNotification</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type <code>PushNotificationIOS</code>. Otherwise, it resolves to <code>null</code>.</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="constructor"></a><code>constructor()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#constructor" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">constructor</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">nativeNotif</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>You will never need to instantiate <code>PushNotificationIOS</code> yourself. Listening to the <code>notification</code> event and invoking <code>getInitialNotification</code> is sufficient.</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="finish"></a><code>finish()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#finish" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">finish</span><span class="token punctuation" style="color:#657b83">(</span><span class="token plain">fetchResult</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>This method is available for remote notifications that have been received via: <code>application:didReceiveRemoteNotification:fetchCompletionHandler:</code> <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler" target="_blank" rel="noopener noreferrer">https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler</a>:</p><p>Call this to execute when the remote notification handling is complete. When calling this block, pass in the fetch result value that best describes the results of your operation. You <em>must</em> call this handler and should do so as soon as possible. For a list of possible values, see <code>PushNotificationIOS.FetchResult</code>.</p><p>If you do not call this method your background remote notifications could be throttled, to read more about it see the above documentation link.</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getmessage"></a><code>getMessage()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getmessage" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getMessage</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>An alias for <code>getAlert</code> to get the notification&#x27;s main message string</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getsound"></a><code>getSound()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getsound" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getSound</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the sound string from the <code>aps</code> object</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getcategory"></a><code>getCategory()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getcategory" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getCategory</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the category string from the <code>aps</code> object</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getalert"></a><code>getAlert()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getalert" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getAlert</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the notification&#x27;s main message from the <code>aps</code> object</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getcontentavailable"></a><code>getContentAvailable()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getcontentavailable" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getContentAvailable</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the content-available number from the <code>aps</code> object</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getbadgecount"></a><code>getBadgeCount()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getbadgecount" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getBadgeCount</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the badge count number from the <code>aps</code> object</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getdata"></a><code>getData()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getdata" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getData</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the data object on the notification</p><hr><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_3pqN" id="getthreadid"></a><code>getThreadID()</code><a aria-hidden="true" tabindex="-1" class="hash-link" href="#getthreadid" title="Direct link to heading">#</a></h3><div class="mdxCodeBlock_xYIz"><div class="codeBlockContent_rlEb"><button tabindex="0" type="button" aria-label="Copy code to clipboard" class="copyButton_kOW4">Copy</button><div class="prism-code language-jsx codeBlock_1AP7"><div class="codeBlockLines_1boI" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">getThreadID</span><span class="token punctuation" style="color:#657b83">(</span><span class="token punctuation" style="color:#657b83">)</span><span class="token punctuation" style="color:#657b83">;</span></div></div></div></div></div><p>Gets the thread ID on the notification</p></div></article><div class="docMetadata margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/facebook/react-native-website/blob/master/website/versioned_docs/version-0.60/pushnotificationios.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 40 40" style="margin-right:0.3em;vertical-align:sub"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col text--right"><em><small class="docMetadata-updated">Last updated on <time datetime="2020-10-29T04:19:29.000Z" class="docLastUpdatedAt_1gIo">10/29/2020</time></small></em></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/0.60/pixelratio"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« PixelRatio</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/0.60/settings"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Settings »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_3iuQ"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#methods" class="table-of-contents__link">Methods</a><ul><li><a href="#presentlocalnotification" class="table-of-contents__link"><code>presentLocalNotification()</code></a></li><li><a href="#schedulelocalnotification" class="table-of-contents__link"><code>scheduleLocalNotification()</code></a></li><li><a href="#cancelalllocalnotifications" class="table-of-contents__link"><code>cancelAllLocalNotifications()</code></a></li><li><a href="#removealldeliverednotifications" class="table-of-contents__link"><code>removeAllDeliveredNotifications()</code></a></li><li><a href="#getdeliverednotifications" class="table-of-contents__link"><code>getDeliveredNotifications()</code></a></li><li><a href="#removedeliverednotifications" class="table-of-contents__link"><code>removeDeliveredNotifications()</code></a></li><li><a href="#setapplicationiconbadgenumber" class="table-of-contents__link"><code>setApplicationIconBadgeNumber()</code></a></li><li><a href="#getapplicationiconbadgenumber" class="table-of-contents__link"><code>getApplicationIconBadgeNumber()</code></a></li><li><a href="#cancellocalnotifications" class="table-of-contents__link"><code>cancelLocalNotifications()</code></a></li><li><a href="#getscheduledlocalnotifications" class="table-of-contents__link"><code>getScheduledLocalNotifications()</code></a></li><li><a href="#addeventlistener" class="table-of-contents__link"><code>addEventListener()</code></a></li><li><a href="#removeeventlistener" class="table-of-contents__link"><code>removeEventListener()</code></a></li><li><a href="#requestpermissions" class="table-of-contents__link"><code>requestPermissions()</code></a></li><li><a href="#abandonpermissions" class="table-of-contents__link"><code>abandonPermissions()</code></a></li><li><a href="#checkpermissions" class="table-of-contents__link"><code>checkPermissions()</code></a></li><li><a href="#getinitialnotification" class="table-of-contents__link"><code>getInitialNotification()</code></a></li><li><a href="#constructor" class="table-of-contents__link"><code>constructor()</code></a></li><li><a href="#finish" class="table-of-contents__link"><code>finish()</code></a></li><li><a href="#getmessage" class="table-of-contents__link"><code>getMessage()</code></a></li><li><a href="#getsound" class="table-of-contents__link"><code>getSound()</code></a></li><li><a href="#getcategory" class="table-of-contents__link"><code>getCategory()</code></a></li><li><a href="#getalert" class="table-of-contents__link"><code>getAlert()</code></a></li><li><a href="#getcontentavailable" class="table-of-contents__link"><code>getContentAvailable()</code></a></li><li><a href="#getbadgecount" class="table-of-contents__link"><code>getBadgeCount()</code></a></li><li><a href="#getdata" class="table-of-contents__link"><code>getData()</code></a></li><li><a href="#getthreadid" class="table-of-contents__link"><code>getThreadID()</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/tutorial">Tutorial</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/components-and-apis">Components and APIs</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/more-resources">More Resources</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/help">The React Native Community</a></li><li class="footer__item"><a class="footer__link-item" href="/showcase">Who&#x27;s using React Native?</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">Ask Questions on Stack Overflow</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contributor Guide</a></li><li class="footer__item"><a href="https://dev.to/t/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">DEV Community</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Find us</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://twitter.com/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a href="https://reactjs.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">React</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy Policy</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms of Service</a></li></ul></div></div><div class="text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_19Ac"><img class="footer__logo" alt="Facebook Open Source Logo" src="/img/oss_logo.png"></a></div><div>Copyright © 2020 Facebook, Inc.</div></div></div></footer></div>
<script src="/styles.07d522c6.js"></script>
<script src="/runtime~main.c0800141.js"></script>
<script src="/main.5a3c9855.js"></script>
<script src="/1.ba9ce8bd.js"></script>
<script src="/2.58cb5d3d.js"></script>
<script src="/1f391b9e.a824c215.js"></script>
<script src="/943.8b024446.js"></script>
<script src="/ae345423.971fbe80.js"></script>
<script src="/17896441.0c201679.js"></script>
<script src="/7e297770.6167f0ee.js"></script>
</body>
</html>