<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Notify sphere</title>
    <description>The latest articles on DEV Community by Notify sphere (@notifysphere).</description>
    <link>https://dev.to/notifysphere</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4178987%2F92cdf39c-900d-4a3f-846c-63c459f1aeb5.png</url>
      <title>DEV Community: Notify sphere</title>
      <link>https://dev.to/notifysphere</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/notifysphere"/>
    <language>en</language>
    <item>
      <title>Android 13 Notification Permission (POST_NOTIFICATIONS): How to Ask and Handle Denial</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Fri, 20 Nov 2026 10:55:09 +0000</pubDate>
      <link>https://dev.to/notifysphere/android-13-notification-permission-postnotifications-how-to-ask-and-handle-denial-24mi</link>
      <guid>https://dev.to/notifysphere/android-13-notification-permission-postnotifications-how-to-ask-and-handle-denial-24mi</guid>
      <description>&lt;p&gt;Since Android 13, a newly installed app can't show notifications until the user allows it. If your push notifications work on older phones but never appear on new ones, this permission is usually why. Here's how it works, when to ask, and what to do when people say no.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed in Android 13
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Notifications became a &lt;strong&gt;runtime permission&lt;/strong&gt;: &lt;code&gt;android.permission.POST_NOTIFICATIONS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  New installs on Android 13+ start with notifications &lt;strong&gt;off&lt;/strong&gt; until the user taps Allow.&lt;/li&gt;
&lt;li&gt;  Apps that already had notifications on before the phone updated to Android 13 usually keep them, so the problem shows up mostly with new users.&lt;/li&gt;
&lt;li&gt;  Android 12 and lower are unaffected: the permission is granted at install time and the check simply returns true.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Declare the permission
&lt;/h2&gt;

&lt;p&gt;Target API 33 or higher and add the permission to your manifest. Without the manifest entry the dialog never appears, no matter how you request it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- AndroidManifest.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.POST_NOTIFICATIONS"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Ask at the right moment
&lt;/h2&gt;

&lt;p&gt;You only get a couple of chances: after two denials Android stops showing the dialog. So don't ask on the first screen. Ask right after the user does something a notification would help with, and tell them what they'll get, for example "We'll let you know when your order ships." A short screen of your own before the system dialog, with a clear reason, gets noticeably more people to allow it.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Request it in Kotlin
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;askNotifications&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="nf"&gt;registerForActivityResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ActivityResultContracts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RequestPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;showWhyNotificationsHelp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;maybeAskForNotifications&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;VERSION&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SDK_INT&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="c1"&gt;// granted at install on Android 12 and lower&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ContextCompat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;checkSelfPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Manifest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;permission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;POST_NOTIFICATIONS&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;PackageManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PERMISSION_GRANTED&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;granted&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Unit&lt;/span&gt;
        &lt;span class="nf"&gt;shouldShowRequestPermissionRationale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Manifest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;permission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;POST_NOTIFICATIONS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="nf"&gt;showWhyNotificationsHelp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// explain, then call askNotifications.launch(...)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;askNotifications&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Manifest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;permission&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;POST_NOTIFICATIONS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;shouldShowRequestPermissionRationale()&lt;/code&gt; returns true after the user has denied once. That's your cue to explain why notifications are useful before asking a second, and final, time.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. React Native
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;PermissionsAndroid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Platform&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-native"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;askForNotifications&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Platform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OS&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"android"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nc"&gt;Platform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Version&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;PermissionsAndroid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;PermissionsAndroid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PERMISSIONS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;POST_NOTIFICATIONS&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nc"&gt;PermissionsAndroid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RESULTS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;GRANTED&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Call it from the screen where the permission makes sense, not on app start. The full push setup is in the &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;React Native push notifications guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Flutter
&lt;/h2&gt;

&lt;p&gt;Recent versions of &lt;code&gt;firebase_messaging&lt;/code&gt; show the Android 13 dialog from the same &lt;code&gt;requestPermission()&lt;/code&gt; call you use for iOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;FirebaseMessaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requestPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;authorizationStatus&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;AuthorizationStatus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;authorized&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;authorizationStatus&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;AuthorizationStatus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;provisional&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If notifications still don't show in the background after permission is granted, work through &lt;a href="https://notifysphere.net/blog/flutter-push-notifications-not-received-in-background" rel="noopener noreferrer"&gt;Flutter push notifications not received in background&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Handle "Don't allow"
&lt;/h2&gt;

&lt;p&gt;Once the permission is permanently denied, requesting it again does nothing. Show a small banner or settings row instead, and send the user straight to your app's notification settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Open this app's notification settings (Android 8+)&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="n"&gt;intent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Intent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ACTION_APP_NOTIFICATION_SETTINGS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;apply&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;putExtra&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;EXTRA_APP_PACKAGE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;packageName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;startActivity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the state again when the user comes back to the app. Users can also turn notifications off later from Settings without your app ever being asked, so check &lt;code&gt;NotificationManagerCompat.from(context).areNotificationsEnabled()&lt;/code&gt; before relying on push for anything important.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Test both paths
&lt;/h2&gt;

&lt;p&gt;You don't need to reinstall the app to reset the permission. Use adb:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Remove the permission to test the "not granted" path&lt;/span&gt;
adb shell pm revoke com.example.app android.permission.POST_NOTIFICATIONS

&lt;span class="c"&gt;# Grant it again&lt;/span&gt;
adb shell pm grant com.example.app android.permission.POST_NOTIFICATIONS

&lt;span class="c"&gt;# Start completely fresh, as a new install would&lt;/span&gt;
adb shell pm clear com.example.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Measure your opt-in rate
&lt;/h2&gt;

&lt;p&gt;If only half your Android users allow notifications, every campaign reaches half the audience you think it does. notifySphere shows subscribers, monthly active users and delivery for every campaign, so you can see how many devices can actually receive a push. To build and test a payload by hand, try the free &lt;a href="https://notifysphere.net/tools/fcm-payload-builder" rel="noopener noreferrer"&gt;FCM payload builder&lt;/a&gt; or &lt;a href="https://notifysphere.net/tools/push-notification-preview" rel="noopener noreferrer"&gt;push notification preview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is the POST_NOTIFICATIONS permission?
&lt;/h3&gt;

&lt;p&gt;It's the runtime permission Android 13 (API level 33) added for showing notifications. Before Android 13 apps could post notifications by default; now a newly installed app needs the user to tap Allow first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I still get an FCM token if the user denies notifications?
&lt;/h3&gt;

&lt;p&gt;Yes. Firebase Cloud Messaging still issues a token and delivers messages to the device. The system just won't display notification messages, so the user never sees them. Data-only messages still reach your app's handler.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happens if my app targets Android 12 or lower?
&lt;/h3&gt;

&lt;p&gt;On an Android 13 device the system asks on your behalf, typically when your app creates its first notification channel. You lose control over when the dialog appears, so target API 33 or higher and ask at a moment you choose.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why doesn't the permission dialog show any more?
&lt;/h3&gt;

&lt;p&gt;After the user denies it twice, Android stops showing the dialog and the request returns denied immediately. From then on, the only way to turn notifications on is the app's notification settings, so link the user there with a short explanation.&lt;/p&gt;

&lt;h3&gt;
  
  
  When is the best time to ask for notification permission?
&lt;/h3&gt;

&lt;p&gt;When the user has just done something that a notification would help with, such as placing an order, booking a slot or following a topic. Asking on the very first screen, before the user knows what the app does, gets far more denials.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/android-13-notification-permission" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK, &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>Fix “No APNS token specified before fetching FCM Token” on iOS (React Native &amp; Flutter)</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Fri, 20 Nov 2026 10:54:29 +0000</pubDate>
      <link>https://dev.to/notifysphere/fix-no-apns-token-specified-before-fetching-fcm-token-on-ios-react-native-flutter-3ekm</link>
      <guid>https://dev.to/notifysphere/fix-no-apns-token-specified-before-fetching-fcm-token-on-ios-react-native-flutter-3ekm</guid>
      <description>&lt;p&gt;You set up Firebase Cloud Messaging, it works on Android, and on iOS the app throws &lt;code&gt;No APNS token specified before fetching FCM Token&lt;/code&gt;. Here's what the error actually means and how to fix it in React Native, Flutter and native Swift.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the error means
&lt;/h2&gt;

&lt;p&gt;On iOS, getting a push token is a two-step handoff:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Your app registers with Apple Push Notification service (APNs), and iOS gives it an APNs token.&lt;/li&gt;
&lt;li&gt; Firebase exchanges that APNs token for an FCM token, which your server uses to send pushes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If your code calls &lt;code&gt;getToken()&lt;/code&gt; before step 1 has finished, or step 1 fails silently, Firebase has nothing to exchange and throws this error. The exact wording depends on your stack:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// React Native Firebase
[messaging/unknown] No APNS token specified before fetching FCM Token

// Flutter (firebase_messaging)
[firebase_messaging/apns-token-not-set] APNS token has not been set yet.

// Native iOS log
APNS device token not set before retrieving FCM Token for Sender ID '…'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Quick checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Push Notifications capability&lt;/strong&gt; is added in Xcode under Signing &amp;amp; Capabilities.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Background Modes → Remote notifications&lt;/strong&gt; is enabled.&lt;/li&gt;
&lt;li&gt;  You're testing on a &lt;strong&gt;real iPhone&lt;/strong&gt;, not the simulator.&lt;/li&gt;
&lt;li&gt;  The app &lt;strong&gt;registers for remote notifications before&lt;/strong&gt; calling &lt;code&gt;getToken()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  If method swizzling is off, the AppDelegate &lt;strong&gt;passes the APNs token to Firebase&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Add the Push Notifications capability
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;ios/YourApp.xcworkspace&lt;/code&gt; in Xcode, select your app target, go to &lt;strong&gt;Signing &amp;amp; Capabilities&lt;/strong&gt; and add &lt;strong&gt;Push Notifications&lt;/strong&gt; and &lt;strong&gt;Background Modes&lt;/strong&gt; (tick &lt;em&gt;Remote notifications&lt;/em&gt;). This adds the &lt;code&gt;aps-environment&lt;/code&gt; entitlement. Without it, iOS refuses to issue an APNs token and you get this error every time. If you sign with a manual provisioning profile, regenerate it after enabling push.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Fix the call order in React Native
&lt;/h2&gt;

&lt;p&gt;React Native Firebase registers for remote messages automatically by default, but if your code asks for the token very early at launch, it can run before registration completes. Request permission, make sure the device is registered, then fetch the token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@react-native-firebase/messaging"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getFcmToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Ask for permission (shows the iOS prompt)&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requestPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Make sure the device is registered with APNs first&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isDeviceRegisteredForRemoteMessages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerDeviceForRemoteMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// 3. Only now ask Firebase for the FCM token&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you set &lt;code&gt;messaging_ios_auto_register_for_remote_messages&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; in &lt;code&gt;firebase.json&lt;/code&gt;, the &lt;code&gt;registerDeviceForRemoteMessages()&lt;/code&gt; call above is required.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Wait for the APNs token in Flutter
&lt;/h2&gt;

&lt;p&gt;In Flutter, &lt;code&gt;getToken()&lt;/code&gt; fails with &lt;code&gt;apns-token-not-set&lt;/code&gt; when the APNs token hasn't arrived yet. Check &lt;code&gt;getAPNSToken()&lt;/code&gt; first and give it a moment on first launch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FirebaseMessaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requestPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// The APNs token can arrive a moment after launch, so wait for it&lt;/span&gt;
&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;apnsToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAPNSToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;apnsToken&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Future&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;apnsToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAPNSToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;apnsToken&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;fcmToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// send fcmToken to your server&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also listen to &lt;code&gt;FirebaseMessaging.instance.onTokenRefresh&lt;/code&gt;, so you still capture the token if it arrives after your retries.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Pass the token yourself if swizzling is disabled
&lt;/h2&gt;

&lt;p&gt;Firebase normally intercepts the APNs token through method swizzling. If your &lt;code&gt;Info.plist&lt;/code&gt; sets &lt;code&gt;FirebaseAppDelegateProxyEnabled&lt;/code&gt; to &lt;code&gt;NO&lt;/code&gt;, which some apps do to avoid conflicts with other SDKs, you have to hand the token over manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="c1"&gt;// AppDelegate.swift: needed when FirebaseAppDelegateProxyEnabled is NO&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UIApplication&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="n"&gt;didRegisterForRemoteNotificationsWithDeviceToken&lt;/span&gt; &lt;span class="n"&gt;deviceToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;Messaging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;apnsToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;deviceToken&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UIApplication&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="n"&gt;didFailToRegisterForRemoteNotificationsWithError&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"APNs registration failed: \(error)"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The failure callback is worth adding either way. If registration fails, it tells you why, usually a missing entitlement.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Test on a real device
&lt;/h2&gt;

&lt;p&gt;APNs registration on the iOS Simulator is unreliable, even on setups that can display simulated pushes. If the error only appears in the simulator, try a real iPhone before changing any code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Skip the token plumbing
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;notifySphere React Native SDK&lt;/a&gt; registers the device with APNs before it requests the FCM token, so this ordering problem doesn't come up. It also tracks delivery and taps for every notification. Setting up the Apple side for the first time? Follow the &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push guide&lt;/a&gt; for the APNs key and capabilities, or the &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;Flutter push guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What does “No APNS token specified before fetching FCM Token” mean?
&lt;/h3&gt;

&lt;p&gt;On iOS, Firebase Cloud Messaging needs the device's APNs token from Apple before it can create an FCM token. The error means your app asked Firebase for the FCM token before iOS had delivered the APNs token, or iOS never delivered one at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does this error happen on Android?
&lt;/h3&gt;

&lt;p&gt;No. Android doesn't use APNs, so FCM tokens are issued directly. The error is specific to iOS (and macOS) apps using Firebase Messaging.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I get an APNs token on the iOS Simulator?
&lt;/h3&gt;

&lt;p&gt;Support is limited. Recent Xcode versions on Apple silicon Macs can deliver remote notifications to the simulator, but registration is still unreliable there. Test push notifications on a real iPhone to rule the simulator out.&lt;/p&gt;

&lt;h3&gt;
  
  
  I uploaded my APNs key to Firebase. Why do I still get this error?
&lt;/h3&gt;

&lt;p&gt;The APNs key in the Firebase console is used when Firebase sends a push to Apple. This error happens earlier, on the device, when the app registers with APNs. Check the Push Notifications capability, the provisioning profile and the order of your calls instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know if APNs registration failed?
&lt;/h3&gt;

&lt;p&gt;Implement application(_:didFailToRegisterForRemoteNotificationsWithError:) in your AppDelegate and log the error. The most common message is a missing aps-environment entitlement, which means the Push Notifications capability or provisioning profile is wrong.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/no-apns-token-specified-before-fetching-fcm-token" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK, &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>APNs BadDeviceToken (400): Causes and Fix, Including Sandbox vs Production</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Mon, 16 Nov 2026 05:09:59 +0000</pubDate>
      <link>https://dev.to/notifysphere/apns-baddevicetoken-400-causes-and-fix-including-sandbox-vs-production-564i</link>
      <guid>https://dev.to/notifysphere/apns-baddevicetoken-400-causes-and-fix-including-sandbox-vs-production-564i</guid>
      <description>&lt;p&gt;Your iOS push fails with &lt;code&gt;400&lt;/code&gt; and &lt;code&gt;"reason": "BadDeviceToken"&lt;/code&gt;. Before you delete that token, check one thing: is it going to the right APNs environment? Most of the time it's a sandbox token sent to production, or the other way round.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the error looks like
&lt;/h2&gt;

&lt;p&gt;APNs replies with HTTP 400 and a JSON body with the reason:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;
&lt;span class="n"&gt;apns&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;5E3F&lt;/span&gt;&lt;span class="mi"&gt;9C1A&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7B2D&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4C&lt;/span&gt;&lt;span class="mf"&gt;8E-9A&lt;/span&gt;&lt;span class="mi"&gt;61&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2F&lt;/span&gt;&lt;span class="mb"&gt;0B&lt;/span&gt;&lt;span class="mi"&gt;3D&lt;/span&gt;&lt;span class="mf"&gt;4E5A&lt;/span&gt;&lt;span class="mi"&gt;6C&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"BadDeviceToken"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apple's description is simply that the device token is invalid. The response doesn't tell you why, so check the likely causes in order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cause 1: sandbox and production are mixed up
&lt;/h2&gt;

&lt;p&gt;APNs has two environments, and a device token only works in the one it came from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Development builds (run from Xcode with a development profile)
https://api.sandbox.push.apple.com/3/device/&amp;lt;device-token&amp;gt;

# TestFlight, Ad Hoc and App Store builds
https://api.push.apple.com/3/device/&amp;lt;device-token&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;A build run from Xcode&lt;/strong&gt; with a development provisioning profile has &lt;code&gt;aps-environment&lt;/code&gt; set to &lt;code&gt;development&lt;/code&gt; and gets sandbox tokens. So does the iOS Simulator.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;TestFlight, Ad Hoc and App Store builds&lt;/strong&gt; are signed for distribution and get production tokens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A typical story: push works perfectly while you test from Xcode, then every TestFlight tester gets &lt;code&gt;BadDeviceToken&lt;/code&gt;, because the server still sends to the sandbox host. Or the reverse, after someone switches the server to production and keeps testing from Xcode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; store the environment with each token when the app uploads it (for example a &lt;code&gt;sandbox&lt;/code&gt; flag set from your build configuration), and send each token to its matching host.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other causes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;The token string was changed.&lt;/strong&gt; APNs device tokens arrive as binary data. Convert them to a hexadecimal string once and store it exactly. Using &lt;code&gt;description&lt;/code&gt; on the token, adding spaces or angle brackets, or cutting the string short all produce an invalid token.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;You sent an FCM token to APNs.&lt;/strong&gt; If your app uses Firebase, the token from &lt;code&gt;Messaging.messaging().fcmToken&lt;/code&gt; is an FCM token. It goes to FCM, not to APNs directly. The APNs token is the one from &lt;code&gt;didRegisterForRemoteNotificationsWithDeviceToken&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The token belongs to another app.&lt;/strong&gt; Tokens are tied to the app that requested them. If you have several apps or bundle IDs, check that you send each token with the right one. This often shows up as &lt;code&gt;DeviceTokenNotForTopic&lt;/code&gt; instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A quick way to find the cause
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Get a fresh token from a test device and log it on the device.&lt;/li&gt;
&lt;li&gt; Compare it with what your server stored, character by character.&lt;/li&gt;
&lt;li&gt; Note how that build was installed: from Xcode, or through TestFlight or the App Store.&lt;/li&gt;
&lt;li&gt; Send to the matching host. If it works, the problem was the environment.&lt;/li&gt;
&lt;li&gt; If it still fails on the right host with an exact token, check the bundle ID and your APNs key.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How it differs from other APNs errors
&lt;/h2&gt;

&lt;p&gt;Only delete a token when the error says the token itself is dead:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reason&lt;/th&gt;
&lt;th&gt;HTTP&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;th&gt;What to do&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BadDeviceToken&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;The token is invalid for this request, often the wrong environment&lt;/td&gt;
&lt;td&gt;Check the environment and token string first, then delete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Unregistered&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;410&lt;/td&gt;
&lt;td&gt;The token is no longer active for this topic&lt;/td&gt;
&lt;td&gt;Delete the token&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DeviceTokenNotForTopic&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;The token doesn't belong to the &lt;code&gt;apns-topic&lt;/code&gt; you sent&lt;/td&gt;
&lt;td&gt;Set &lt;code&gt;apns-topic&lt;/code&gt; to the app's bundle ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;ExpiredProviderToken&lt;/code&gt;, &lt;code&gt;InvalidProviderToken&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;td&gt;Your signing JWT is too old or can't be verified&lt;/td&gt;
&lt;td&gt;Fix the key ID, team ID or signing. Don't delete device tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TooManyProviderTokenUpdates&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;429&lt;/td&gt;
&lt;td&gt;You create a new JWT too often&lt;/td&gt;
&lt;td&gt;Reuse one JWT. Apple asks you to refresh it no more than every 20 minutes and at least every 60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TooManyRequests&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;429&lt;/td&gt;
&lt;td&gt;Too many pushes to the same device in a short time&lt;/td&gt;
&lt;td&gt;Slow down and retry later&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;InternalServerError&lt;/code&gt;, &lt;code&gt;ServiceUnavailable&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;500, 503&lt;/td&gt;
&lt;td&gt;A temporary problem at APNs&lt;/td&gt;
&lt;td&gt;Retry with backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In code, the branching can look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// reason comes from the JSON body of a non-200 APNs response&lt;/span&gt;
&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"Unregistered"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;           &lt;span class="c1"&gt;// 410: the token is no longer active&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;removeToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"BadDeviceToken"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;         &lt;span class="c1"&gt;// 400: check the environment first&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;isEnvironmentMismatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;sendToOtherHost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;removeToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"DeviceTokenNotForTopic"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;// 400: wrong apns-topic (bundle ID)&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fixTopicConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"TooManyRequests"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"InternalServerError"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"ServiceUnavailable"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;retryWithBackoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you send iOS pushes through Firebase instead, APNs problems come back as FCM errors. See &lt;a href="https://notifysphere.net/blog/fcm-unregistered-token" rel="noopener noreferrer"&gt;FCM UNREGISTERED: Requested entity was not found&lt;/a&gt; for that side.&lt;/p&gt;

&lt;h2&gt;
  
  
  On notifySphere
&lt;/h2&gt;

&lt;p&gt;notifySphere delivers iOS pushes through FCM and APNs, and its &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;React Native&lt;/a&gt; and &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;Flutter&lt;/a&gt; SDKs register the device for you, so you don't convert or store tokens yourself. Still setting up iOS? Start with the &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push guide&lt;/a&gt;, or fix &lt;a href="https://notifysphere.net/blog/no-apns-token-specified-before-fetching-fcm-token" rel="noopener noreferrer"&gt;No APNS token specified&lt;/a&gt; if you hit that first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What does APNs BadDeviceToken mean?
&lt;/h3&gt;

&lt;p&gt;APNs returns 400 with the reason BadDeviceToken when the device token in the request path is invalid. The most common cause is sending a token to the wrong APNs environment: a sandbox token sent to api.push.apple.com, or a production token sent to api.sandbox.push.apple.com.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I delete a token that returns BadDeviceToken?
&lt;/h3&gt;

&lt;p&gt;Only after you've ruled out an environment mismatch. If a development build's token is sent to the production host, the token is fine; it's going to the wrong place. Delete it if it also fails on the right host, or if the stored string was damaged.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between BadDeviceToken and Unregistered?
&lt;/h3&gt;

&lt;p&gt;BadDeviceToken (400) means the token isn't valid for that request, often because of the environment. Unregistered (410) means the token is no longer active for your app's topic, usually after an uninstall. A 410 response also includes a timestamp of when APNs last confirmed the token was invalid.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does BadDeviceToken happen only with TestFlight, or only in development?
&lt;/h3&gt;

&lt;p&gt;TestFlight, Ad Hoc and App Store builds get production tokens. Builds run from Xcode with a development provisioning profile get sandbox tokens. If your server always uses one host, one of the two kinds of build will fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need separate APNs keys for sandbox and production?
&lt;/h3&gt;

&lt;p&gt;Not usually. A token-based (.p8) APNs key can work with both environments, though Apple lets you limit a key to one. If the key is limited to the wrong environment, APNs returns 403 BadEnvironmentKeyInToken, not BadDeviceToken. Certificate-based auth uses separate certificates, and the wrong one returns 403 BadCertificateEnvironment.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/apns-bad-device-token" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>WhatsApp Business API: A Complete Developer Guide</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Thu, 05 Nov 2026 14:02:56 +0000</pubDate>
      <link>https://dev.to/notifysphere/whatsapp-business-api-a-complete-developer-guide-2ce5</link>
      <guid>https://dev.to/notifysphere/whatsapp-business-api-a-complete-developer-guide-2ce5</guid>
      <description>&lt;p&gt;The WhatsApp Business API lets your backend send and receive WhatsApp messages programmatically — order updates, OTPs, reminders, and support replies — instead of typing them in the WhatsApp Business app. This guide covers how it works end to end, so you can design your integration before writing code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the WhatsApp Business API?
&lt;/h2&gt;

&lt;p&gt;WhatsApp offers two business products. The &lt;strong&gt;WhatsApp Business app&lt;/strong&gt; is a phone app for small businesses that reply by hand. The &lt;strong&gt;WhatsApp Business Platform&lt;/strong&gt; — usually called the WhatsApp Business API — is for software: your systems send messages over HTTPS, and WhatsApp calls your server back with replies and delivery updates.&lt;/p&gt;

&lt;p&gt;Meta hosts the API (the &lt;em&gt;Cloud API&lt;/em&gt;), so there is no server for you to run. You can call it directly, or go through a provider (a &lt;a href="https://notifysphere.net/blog/whatsapp-bsp" rel="noopener noreferrer"&gt;WhatsApp BSP&lt;/a&gt;) that adds a dashboard, template management, analytics, and integrations on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the API works
&lt;/h2&gt;

&lt;p&gt;Every integration has the same building blocks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;A Meta Business account&lt;/strong&gt; that owns a &lt;strong&gt;WhatsApp Business Account (WABA)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;A phone number&lt;/strong&gt; registered to that WABA. It can't be in active use on the regular WhatsApp or WhatsApp Business app at the same time.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;An access token&lt;/strong&gt; your server uses to call the Graph API, and the number's &lt;strong&gt;phone number ID&lt;/strong&gt;, which appears in the send URL.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;A webhook URL&lt;/strong&gt; where WhatsApp posts incoming messages and status updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sending is a single &lt;code&gt;POST&lt;/code&gt; to &lt;code&gt;https://graph.facebook.com/{version}/{phone-number-id}/messages&lt;/code&gt;. Receiving happens through your webhook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Message templates
&lt;/h2&gt;

&lt;p&gt;You can't start a conversation with free-form text. Any message your business sends first must use a &lt;strong&gt;template&lt;/strong&gt; that Meta has reviewed and approved. Templates have placeholders, such as &lt;code&gt;{{1}}&lt;/code&gt; for an order number, that you fill in at send time.&lt;/p&gt;

&lt;p&gt;Every template belongs to a category, and the category decides what it's for and what it costs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Marketing&lt;/strong&gt; — offers, announcements, re-engagement.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Utility&lt;/strong&gt; — updates about something the customer already did: order confirmations, shipping, payment receipts, appointment reminders.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Authentication&lt;/strong&gt; — one-time passwords and login codes, with fixed preset wording.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pick the category honestly. Meta can re-categorize a template that doesn't match its content — a promotional message submitted as utility, for example.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 24-hour customer service window
&lt;/h2&gt;

&lt;p&gt;When a customer messages you, a 24-hour customer service window opens. Inside that window you can reply with free-form messages — text, images, documents, buttons — without a template. Once it closes, you need an approved template again to reach that customer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending a template from Node.js
&lt;/h2&gt;

&lt;p&gt;Here is a minimal call against Meta's Cloud API that sends an approved &lt;code&gt;order_shipped&lt;/code&gt; template with two body parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Node.js 18+ (built-in fetch)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;GRAPH_VERSION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;v22.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// use the latest version listed in Meta's docs&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PHONE_NUMBER_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WA_PHONE_NUMBER_ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ACCESS_TOKEN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WA_ACCESS_TOKEN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sendOrderShipped&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;`https://graph.facebook.com/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;GRAPH_VERSION&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;PHONE_NUMBER_ID&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/messages`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;ACCESS_TOKEN&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;messaging_product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;whatsapp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// recipient in international format, e.g. "919876543210"&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;template&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;order_shipped&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;language&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="na"&gt;components&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="na"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;orderId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;eta&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`WhatsApp send failed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// contains the message id you'll see again in status webhooks&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store the message ID from the response. Every delivery update for this message refers back to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Webhooks: replies and delivery receipts
&lt;/h2&gt;

&lt;p&gt;WhatsApp sends two kinds of events to your webhook. Payloads with a &lt;code&gt;messages&lt;/code&gt; array are incoming messages from customers. Payloads with a &lt;code&gt;statuses&lt;/code&gt; array are updates on messages you sent — &lt;code&gt;sent&lt;/code&gt;, &lt;code&gt;delivered&lt;/code&gt;, &lt;code&gt;read&lt;/code&gt;, or &lt;code&gt;failed&lt;/code&gt;, with error details when sending fails.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Express webhook receiver (simplified)&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/webhooks/whatsapp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entry&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;changes&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="c1"&gt;// Incoming customer messages&lt;/span&gt;
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Message from&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="c1"&gt;// Delivery updates for messages you sent: sent, delivered, read, failed&lt;/span&gt;
      &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statuses&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;is now&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// acknowledge quickly, process asynchronously&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Acknowledge with a &lt;code&gt;200&lt;/code&gt; quickly and do heavy work in a queue. Slow or failing endpoints get retried, which can produce duplicate events, so make your handler idempotent on the message ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opt-in rules
&lt;/h2&gt;

&lt;p&gt;You must have a customer's permission before messaging them on WhatsApp, and the opt-in should make clear they'll receive messages from your business on WhatsApp. Keep a record of when and how each customer opted in, and honor opt-out requests promptly. Messaging people who didn't ask for it leads to blocks and reports, which lower your quality rating and can limit how many people you can message.&lt;/p&gt;

&lt;h2&gt;
  
  
  How WhatsApp API pricing works
&lt;/h2&gt;

&lt;p&gt;Meta charges per delivered template message. The rate depends on the template category and the recipient's country, and Meta publishes rate cards that it updates from time to time. Marketing templates cost the most; utility and authentication templates cost less. Since October 1, 2026, replies inside the 24-hour window are charged too, after 1,000 free service messages per phone number each month. See &lt;a href="https://notifysphere.net/blog/whatsapp-api-changes-2026" rel="noopener noreferrer"&gt;WhatsApp API changes in 2026&lt;/a&gt; for the details and &lt;a href="https://notifysphere.net/blog/whatsapp-api-pricing-india" rel="noopener noreferrer"&gt;WhatsApp API pricing in India&lt;/a&gt; for worked monthly bills.&lt;/p&gt;

&lt;p&gt;Providers then add their own fee on top. On notifySphere, Meta's rate is passed through at cost and the processing fee per message is ₹0.04 for marketing, ₹0.02 for utility, ₹0.01 for authentication, ₹0.02 for service. See &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt; for details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go-live checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Business verified in Meta Business Manager and a phone number registered to your WABA.&lt;/li&gt;
&lt;li&gt;  Templates approved for every business-initiated message you plan to send.&lt;/li&gt;
&lt;li&gt;  Webhook deployed over HTTPS, verified, and idempotent.&lt;/li&gt;
&lt;li&gt;  Opt-in captured and stored for every recipient, with a working opt-out.&lt;/li&gt;
&lt;li&gt;  Failed statuses monitored, so broken templates or numbers surface quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;dashboard.notifysphere.net/whatsapp/send&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn3bmeqrf7nigwmpde270.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn3bmeqrf7nigwmpde270.png" alt="notifySphere WhatsApp Send Message screen with recipient options, approved template picker, and message preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sending an approved template from the notifySphere dashboard: pick recipients, choose a template, and preview it before sending.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the WhatsApp Business API with notifySphere
&lt;/h2&gt;

&lt;p&gt;notifySphere connects to your own WhatsApp Business Account and handles the operational layer: template submission and approval tracking, sending from the dashboard or your backend, delivery and read receipts, consent tracking, and routing customer replies into support tickets. The same account also runs your push notifications and app attribution, so a customer's WhatsApp, push, and support history live in one place.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/whatsapp-business-api-guide" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>api</category>
      <category>webdev</category>
      <category>business</category>
    </item>
    <item>
      <title>Firebase iOS Push Notifications: APNs Key and SDK Setup</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Mon, 02 Nov 2026 10:36:08 +0000</pubDate>
      <link>https://dev.to/notifysphere/firebase-ios-push-notifications-apns-key-and-sdk-setup-2p21</link>
      <guid>https://dev.to/notifysphere/firebase-ios-push-notifications-apns-key-and-sdk-setup-2p21</guid>
      <description>&lt;p&gt;Firebase Cloud Messaging (FCM) can deliver push notifications to iPhones, but it doesn't talk to iOS devices directly — it goes through Apple Push Notification service (APNs). Most “Firebase iOS push isn't working” problems come from the Apple side of that handshake. This guide sets up both sides in order.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Firebase push works on iOS
&lt;/h2&gt;

&lt;p&gt;Your app registers with APNs and receives an APNs device token. The Firebase iOS SDK maps that token to an FCM registration token, which is the one your server uses. When you send a message, FCM authenticates with APNs using the key you uploaded, and APNs delivers it to the device. If Firebase can't authenticate with APNs, nothing arrives — even though everything looks fine in your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  A paid Apple Developer Program membership — push needs one.&lt;/li&gt;
&lt;li&gt;  A Firebase project with your iOS app added, and its &lt;code&gt;GoogleService-Info.plist&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  Xcode and a physical iPhone or iPad. The Simulator isn't a reliable test for remote push.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Create an APNs authentication key
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; In the Apple Developer portal, open &lt;strong&gt;Certificates, Identifiers &amp;amp; Profiles → Keys&lt;/strong&gt; and create a new key.&lt;/li&gt;
&lt;li&gt; Enable &lt;strong&gt;Apple Push Notifications service (APNs)&lt;/strong&gt; for the key, then register it.&lt;/li&gt;
&lt;li&gt; Download the &lt;code&gt;.p8&lt;/code&gt; file and note its &lt;strong&gt;Key ID&lt;/strong&gt;. Apple lets you download it only once, so store it somewhere safe.&lt;/li&gt;
&lt;li&gt; Note your &lt;strong&gt;Team ID&lt;/strong&gt;, shown in your developer account's membership details.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An authentication key doesn't expire like a push certificate, and one key works for all your apps — which is why it's the recommended option over the older &lt;code&gt;.p12&lt;/code&gt; certificates.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Upload the key to Firebase
&lt;/h2&gt;

&lt;p&gt;In the Firebase console, open &lt;strong&gt;Project settings → Cloud Messaging&lt;/strong&gt;. Under your Apple app, upload the &lt;code&gt;.p8&lt;/code&gt; key and enter the Key ID and Team ID. Firebase uses this key to authenticate with APNs on your behalf.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Add the Firebase iOS SDK
&lt;/h2&gt;

&lt;p&gt;In Xcode, choose &lt;strong&gt;File → Add Package Dependencies&lt;/strong&gt; and add &lt;code&gt;https://github.com/firebase/firebase-ios-sdk&lt;/code&gt;. Select the &lt;strong&gt;FirebaseMessaging&lt;/strong&gt; product. Then drag &lt;code&gt;GoogleService-Info.plist&lt;/code&gt; into your app target.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Enable capabilities
&lt;/h2&gt;

&lt;p&gt;Select your app target, open &lt;strong&gt;Signing &amp;amp; Capabilities&lt;/strong&gt;, and add &lt;strong&gt;Push Notifications&lt;/strong&gt;. Add &lt;strong&gt;Background Modes&lt;/strong&gt; and check &lt;strong&gt;Remote notifications&lt;/strong&gt; if you send silent or data-only pushes.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Request permission and get the FCM token
&lt;/h2&gt;

&lt;p&gt;Configure Firebase at launch, ask the user for permission, register for remote notifications, and listen for the FCM token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;UIKit&lt;/span&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;FirebaseCore&lt;/span&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;FirebaseMessaging&lt;/span&gt;
&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;UserNotifications&lt;/span&gt;

&lt;span class="kd"&gt;@main&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="kt"&gt;AppDelegate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UIResponder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;UIApplicationDelegate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                   &lt;span class="kt"&gt;UNUserNotificationCenterDelegate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;MessagingDelegate&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;application&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UIApplication&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                   &lt;span class="n"&gt;didFinishLaunchingWithOptions&lt;/span&gt; &lt;span class="nv"&gt;launchOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                     &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;UIApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;LaunchOptionsKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Any&lt;/span&gt;&lt;span class="p"&gt;]?)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;FirebaseApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="kt"&gt;Messaging&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delegate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;self&lt;/span&gt;
    &lt;span class="kt"&gt;UNUserNotificationCenter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;current&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delegate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;self&lt;/span&gt;

    &lt;span class="kt"&gt;UNUserNotificationCenter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;current&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;requestAuthorization&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nv"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;badge&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sound&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
      &lt;span class="c1"&gt;// Respect the user's choice; you can ask again later from settings&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerForRemoteNotifications&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Called with a new or refreshed FCM registration token&lt;/span&gt;
  &lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Messaging&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="n"&gt;didReceiveRegistrationToken&lt;/span&gt; &lt;span class="nv"&gt;fcmToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;?)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;guard&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;fcmToken&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// Send this token to your push server&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FCM token: &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;fcmToken&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Show notifications while the app is in the foreground&lt;/span&gt;
  &lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;userNotificationCenter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;center&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UNUserNotificationCenter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                              &lt;span class="n"&gt;willPresent&lt;/span&gt; &lt;span class="nv"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UNNotification&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;UNNotificationPresentationOptions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;banner&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sound&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;badge&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default the Firebase SDK uses method swizzling to pass the APNs token to FCM automatically. If you set &lt;code&gt;FirebaseAppDelegateProxyEnabled&lt;/code&gt; to &lt;code&gt;NO&lt;/code&gt; in your &lt;code&gt;Info.plist&lt;/code&gt;, you must pass the APNs token yourself by setting &lt;code&gt;Messaging.messaging().apnsToken&lt;/code&gt; in &lt;code&gt;didRegisterForRemoteNotificationsWithDeviceToken&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Send a test notification
&lt;/h2&gt;

&lt;p&gt;Run the app on a physical device, accept the permission prompt, and copy the FCM token from the console. In the Firebase console, open &lt;strong&gt;Messaging&lt;/strong&gt;, create a notification, and use &lt;strong&gt;Send test message&lt;/strong&gt; with that token. Test with the app in the foreground, in the background, and fully closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Firebase iOS push isn't working
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;No APNs key in Firebase:&lt;/strong&gt; the token is generated, but nothing is delivered. Check Project settings → Cloud Messaging.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Wrong Team ID or Key ID:&lt;/strong&gt; APNs rejects Firebase's requests. Re-enter both from your Apple developer account.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Bundle ID mismatch:&lt;/strong&gt; the iOS app in Firebase must use exactly the same bundle ID as your Xcode target.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Push Notifications capability missing:&lt;/strong&gt; the app never receives an APNs token, so no FCM token works.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Swizzling disabled without passing the APNs token:&lt;/strong&gt; FCM has no APNs token to map.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Permission denied:&lt;/strong&gt; the user declined the prompt; notifications are delivered silently or not shown.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using React Native or Flutter?
&lt;/h2&gt;

&lt;p&gt;The Apple-side steps — APNs key, Firebase upload, and capabilities — are the same. The notifySphere SDKs handle the token and permission code for you: see the &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;React Native guide&lt;/a&gt; and the &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;Flutter guide&lt;/a&gt;. notifySphere runs on Firebase Cloud Messaging, so once your Firebase project can reach APNs, uploading its service account lets you send segmented iOS, Android, and web campaigns from one dashboard.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>WhatsApp BSP List India 2026: Meaning, Top Providers, Charges and How to Choose</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Mon, 02 Nov 2026 06:18:33 +0000</pubDate>
      <link>https://dev.to/notifysphere/whatsapp-bsp-in-india-what-it-is-top-providers-charges-and-how-to-choose-25do</link>
      <guid>https://dev.to/notifysphere/whatsapp-bsp-in-india-what-it-is-top-providers-charges-and-how-to-choose-25do</guid>
      <description>&lt;p&gt;If you want to send WhatsApp messages from your own software, you'll quickly run into the term “BSP”. Here's what a WhatsApp Business Solution Provider actually does, how Meta's partner types differ, what they charge, and how to pick one without overpaying.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a WhatsApp BSP?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;WhatsApp Business Solution Provider (BSP)&lt;/strong&gt; is a company that helps businesses access the WhatsApp Business Platform — the API version of WhatsApp. A BSP typically handles onboarding your business and phone number, gives you a dashboard to manage message templates and send campaigns, connects WhatsApp to your other tools, and supports you when something breaks.&lt;/p&gt;

&lt;p&gt;Meta now calls these companies &lt;strong&gt;Solution Partners&lt;/strong&gt;, but “BSP” is still the term most people search for and use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you need a BSP?
&lt;/h2&gt;

&lt;p&gt;Not strictly. Meta hosts the WhatsApp Cloud API, and any developer can call it directly with a Meta Business account, a verified phone number, and an access token. Going direct means no provider fee — but you build everything else yourself: template management, a send UI, contact lists, opt-in tracking, delivery reports, a shared inbox, and retries.&lt;/p&gt;

&lt;p&gt;A provider makes sense when you want those pieces ready-made, when non-developers need to send campaigns, or when you want WhatsApp inside a wider engagement platform alongside push, email, or support.&lt;/p&gt;

&lt;h2&gt;
  
  
  WhatsApp BSP vs the WhatsApp Business app
&lt;/h2&gt;

&lt;p&gt;The free WhatsApp Business app and a BSP solve different problems. The app is for a person replying to customers by hand from a phone. The API, which you reach directly or through a BSP, is for software sending messages: OTPs, order updates, reminders, and campaigns to thousands of people.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;WhatsApp Business app&lt;/th&gt;
&lt;th&gt;WhatsApp Business API via a BSP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Who sends&lt;/td&gt;
&lt;td&gt;A person, from a phone&lt;/td&gt;
&lt;td&gt;Your backend, dashboard, or automations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bulk and automated messages&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, with approved templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Integrations and webhooks&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Meta's per-message rate plus the provider's fee&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A phone number registered on the API can't be used in the regular WhatsApp or WhatsApp Business app at the same time, so many businesses use a separate number for the API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution Partner vs Tech Provider vs Tech Partner
&lt;/h2&gt;

&lt;p&gt;Meta's partner program has three types. The difference matters mostly for how you're billed:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;What they do&lt;/th&gt;
&lt;th&gt;Who pays Meta&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Solution Partner&lt;/strong&gt; (the classic “BSP”)&lt;/td&gt;
&lt;td&gt;Full WhatsApp services: onboarding, messaging, billing, support&lt;/td&gt;
&lt;td&gt;The partner can extend its credit line and invoice you for Meta's charges&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tech Provider&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Full WhatsApp services, on their own or with a Solution Partner&lt;/td&gt;
&lt;td&gt;You add your own payment method to your WhatsApp Business Account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tech Partner&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Builds add-on solutions on top of the platform&lt;/td&gt;
&lt;td&gt;Depends on the joint solution&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  WhatsApp BSPs in India: the main options
&lt;/h2&gt;

&lt;p&gt;There are dozens of WhatsApp providers in India. Most businesses end up choosing between these, and the right one depends on who will use it and what you send:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Best suited to&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gupshup&lt;/td&gt;
&lt;td&gt;Large brands and developers who want a mature messaging API and chatbot tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interakt&lt;/td&gt;
&lt;td&gt;Small businesses and D2C stores that want a ready dashboard, catalogue and Shopify-style integrations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AiSensy&lt;/td&gt;
&lt;td&gt;Small teams sending broadcast campaigns and running simple chatbots without code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WATI&lt;/td&gt;
&lt;td&gt;Support teams that need a shared inbox where several agents answer WhatsApp chats&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Twilio&lt;/td&gt;
&lt;td&gt;Developers building WhatsApp into their own product with a global, pay-as-you-go API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exotel&lt;/td&gt;
&lt;td&gt;Businesses that already use cloud calling and want WhatsApp alongside it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;notifySphere&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mobile apps that want WhatsApp, push notifications, install attribution and in-app support in one dashboard, with Meta's rate passed through at cost&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All of them send through the same WhatsApp Business Platform, so message delivery and Meta's rates are the same. What differs is the dashboard, the integrations, the support, and the fee on top. Shortlist two or three by fit, then compare their fees with the table below.&lt;/p&gt;

&lt;h3&gt;
  
  
  More WhatsApp Business API providers in India
&lt;/h3&gt;

&lt;p&gt;Beyond the names above, these companies also offer the WhatsApp Business API in India. The “known for” column is based on how each one describes itself on its own website (checked November 2026):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Known for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MSG91&lt;/td&gt;
&lt;td&gt;SMS and OTP platform that also sells the WhatsApp Business API, for alerts, OTPs and automated conversations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kaleyra&lt;/td&gt;
&lt;td&gt;Enterprise customer messaging, with WhatsApp alongside SMS and other channels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infobip&lt;/td&gt;
&lt;td&gt;Global omnichannel communications platform and WhatsApp Business Platform provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ValueFirst (Tanla)&lt;/td&gt;
&lt;td&gt;Messaging platform for SMS, WhatsApp, RCS and Truecaller, aimed at larger businesses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Karix (Tanla)&lt;/td&gt;
&lt;td&gt;Enterprise messaging provider from the Tanla group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DoubleTick&lt;/td&gt;
&lt;td&gt;Team inbox for sales and support teams, with bulk messaging and several numbers in one place&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gallabox&lt;/td&gt;
&lt;td&gt;AI agents for customer conversations across WhatsApp, Instagram, web chat and voice&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zoko&lt;/td&gt;
&lt;td&gt;WhatsApp marketing, sales and support for Shopify brands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jio Haptik&lt;/td&gt;
&lt;td&gt;Enterprise conversational AI agents, including on WhatsApp&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yellow.ai&lt;/td&gt;
&lt;td&gt;Enterprise AI agents for customer service, including on WhatsApp&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To confirm that a company is a Meta partner, check Meta's Business Partner directory rather than a list like this one. Any provider can still connect you to the same WhatsApp Business Platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get the WhatsApp Business API in India, step by step
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Decide how you'll connect.&lt;/strong&gt; Developers can call Meta's Cloud API directly. If you want a dashboard, campaigns, an inbox and support, pick a provider from the lists above.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Set up a Meta Business portfolio&lt;/strong&gt; (formerly Business Manager) in your company's name. Keeping the account in your own name makes it easier to switch providers later.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Pick a phone number.&lt;/strong&gt; It must be able to receive an SMS or call for verification, and it can't stay active on the WhatsApp or WhatsApp Business app at the same time.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Choose a display name&lt;/strong&gt; that matches your business. Meta reviews it.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Verify your business&lt;/strong&gt; in the Meta Business portfolio. Verification lets you grow your messaging limits over time.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Create message templates&lt;/strong&gt; for anything you send first (OTPs, order updates, offers) and get them approved. The &lt;a href="https://notifysphere.net/tools/whatsapp-template-checker" rel="noopener noreferrer"&gt;template checker&lt;/a&gt; catches common rejection reasons before you submit, and &lt;a href="https://notifysphere.net/blog/whatsapp-template-rejected" rel="noopener noreferrer"&gt;why templates get rejected&lt;/a&gt; explains each one.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Collect opt-in&lt;/strong&gt; from customers before you message them, and start with utility messages before marketing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Building OTPs? The &lt;a href="https://notifysphere.net/blog/whatsapp-otp-api" rel="noopener noreferrer"&gt;WhatsApp OTP API guide&lt;/a&gt; covers the authentication template and code. For the full developer setup, see the &lt;a href="https://notifysphere.net/blog/whatsapp-business-api-guide" rel="noopener noreferrer"&gt;WhatsApp Business API guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How WhatsApp BSP pricing works
&lt;/h2&gt;

&lt;p&gt;Your WhatsApp bill always has two parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Meta's per-message charge.&lt;/strong&gt; Set by Meta, by template category (marketing, utility, authentication) and recipient country. Every provider pays the same Meta rate.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The provider's fee.&lt;/strong&gt; A monthly platform fee, a markup on each message, or both. This is the only part that differs between providers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So when comparing BSPs, ignore the headline per-message price and work out the markup over Meta's rate. Meta's October 2026 India rate card lists marketing templates at ₹0.8631 and utility, authentication and service messages at ₹0.115 per message, before GST. See &lt;a href="https://notifysphere.net/blog/whatsapp-api-changes-2026" rel="noopener noreferrer"&gt;what changed in October 2026&lt;/a&gt; and &lt;a href="https://notifysphere.net/blog/whatsapp-api-pricing-india" rel="noopener noreferrer"&gt;what a monthly bill looks like in India&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What providers charge in India
&lt;/h2&gt;

&lt;p&gt;Per-message pricing published by common providers, checked in October 2026 (excluding GST):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Marketing&lt;/th&gt;
&lt;th&gt;Utility&lt;/th&gt;
&lt;th&gt;Authentication&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AiSensy&lt;/td&gt;
&lt;td&gt;₹1.09&lt;/td&gt;
&lt;td&gt;₹0.145&lt;/td&gt;
&lt;td&gt;₹0.145&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interakt&lt;/td&gt;
&lt;td&gt;₹0.949–₹0.970 (by plan)&lt;/td&gt;
&lt;td&gt;₹0.160&lt;/td&gt;
&lt;td&gt;₹0.129&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gupshup&lt;/td&gt;
&lt;td&gt;Meta rate + $0.001 per message&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Twilio&lt;/td&gt;
&lt;td&gt;Meta rate + $0.005 per message, inbound and outbound&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;notifySphere&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Meta rate + ₹0.04&lt;/td&gt;
&lt;td&gt;Meta rate + ₹0.02&lt;/td&gt;
&lt;td&gt;Meta rate + ₹0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Prices change — confirm on each provider's pricing page. Platform subscription fees are charged separately by some providers and aren't included above.&lt;/p&gt;

&lt;p&gt;Markups add up quickly at volume. At 10,000 marketing and 20,000 utility messages a month, a 26% markup on Meta's rate costs about ₹2,800 more than paying Meta's rate alone, before any platform fee.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to choose a WhatsApp BSP
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Transparent pricing:&lt;/strong&gt; can you see Meta's rate and the provider's fee separately?&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Your own WhatsApp Business Account:&lt;/strong&gt; make sure the account and phone number belong to you, so you can switch providers later without losing them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;API and webhooks:&lt;/strong&gt; if your backend sends OTPs or order updates, check the API docs and delivery webhooks before signing up.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Template management:&lt;/strong&gt; submitting templates and tracking approval in one place saves real time.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Opt-in and compliance:&lt;/strong&gt; look for consent tracking and easy opt-out handling.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Other channels:&lt;/strong&gt; if you also send push notifications or run support, one platform avoids a second vendor and a second customer record.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Billing model:&lt;/strong&gt; decide whether you want the provider to invoice Meta's charges, or to pay Meta directly with your own card.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Can you switch WhatsApp BSPs later?
&lt;/h2&gt;

&lt;p&gt;Yes. Meta supports moving a phone number from one WhatsApp Business Account to another, so you aren't locked in for good. Switching is easiest when the WhatsApp Business Account is in your own name from day one. Before you move, export your contacts and opt-in records, list the templates you rely on, and plan for a short window where sending is paused while the number moves across.&lt;/p&gt;

&lt;h2&gt;
  
  
  WhatsApp on notifySphere
&lt;/h2&gt;

&lt;p&gt;notifySphere connects to your own WhatsApp Business Account and adds template management, campaign sending, delivery and read receipts, consent tracking, and a support inbox — alongside push notifications and app attribution in the same dashboard. Meta's rate is passed through at cost, with a processing fee of ₹0.01–₹0.04 per message. See &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;, or read the &lt;a href="https://notifysphere.net/blog/whatsapp-business-api-guide" rel="noopener noreferrer"&gt;WhatsApp Business API developer guide&lt;/a&gt;. Sending one-time passwords? See the &lt;a href="https://notifysphere.net/blog/whatsapp-otp-api" rel="noopener noreferrer"&gt;WhatsApp OTP API guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What does BSP stand for in WhatsApp?
&lt;/h3&gt;

&lt;p&gt;BSP stands for Business Solution Provider: a company that gives businesses access to the WhatsApp Business Platform (the API), usually with a dashboard, template management, and support. Meta now calls them Solution Partners.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need a BSP to use the WhatsApp Business API?
&lt;/h3&gt;

&lt;p&gt;No. Meta's Cloud API can be called directly with a Meta Business account, a verified phone number, and an access token. A provider is useful when you want a ready-made dashboard, campaigns, contact management, and support instead of building them yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  How much does a WhatsApp BSP charge in India?
&lt;/h3&gt;

&lt;p&gt;Every provider pays Meta the same per-message rate. What differs is the provider's markup or platform fee on top. Published markups in India range from a few paise to over ₹0.20 per marketing message. notifySphere passes Meta's rate through at cost and adds a processing fee of ₹0.01 to ₹0.04 per message.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who are the main WhatsApp BSPs in India?
&lt;/h3&gt;

&lt;p&gt;Commonly used WhatsApp Business API providers in India include Gupshup, Interakt, AiSensy, WATI, Twilio, Exotel and notifySphere. They all send through Meta's WhatsApp Business Platform, so they differ mainly in dashboard, integrations, support and the fee they add on top of Meta's rate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is a WhatsApp BSP the same as a WhatsApp Business API provider?
&lt;/h3&gt;

&lt;p&gt;Yes, in everyday use. BSP (Business Solution Provider) is the older name; Meta now calls these companies Solution Partners or Tech Providers. Any of them gives you access to the WhatsApp Business API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which is the cheapest WhatsApp BSP in India?
&lt;/h3&gt;

&lt;p&gt;Compare the markup over Meta's rate, not the headline price, and include any monthly platform fee. Of the providers compared above, notifySphere has the lowest per-message processing fee. Prices change, so confirm on each provider's pricing page.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I get the WhatsApp Business API in India?
&lt;/h3&gt;

&lt;p&gt;Set up a Meta Business portfolio for your company, pick a phone number that isn't active on the WhatsApp or WhatsApp Business app, choose a display name, and connect the number either directly through Meta's Cloud API or through a provider. Then create message templates and get them approved before sending business-initiated messages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there a list of official WhatsApp BSPs?
&lt;/h3&gt;

&lt;p&gt;Meta keeps a directory of its Business Partners, which is the place to check whether a company is a Meta partner. The list in this guide covers WhatsApp Business API providers commonly used in India and what each one says it is built for.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use the same number in the WhatsApp Business app and the API?
&lt;/h3&gt;

&lt;p&gt;Not at the same time. Once a number is registered on the WhatsApp Business Platform it can't be used in the regular WhatsApp or WhatsApp Business app, so many businesses use a separate number for the API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I change my WhatsApp BSP later?
&lt;/h3&gt;

&lt;p&gt;Yes. Meta supports moving a phone number between WhatsApp Business Accounts. Keeping the account in your own business's name makes the move much simpler.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/whatsapp-bsp" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>api</category>
      <category>webdev</category>
      <category>business</category>
    </item>
    <item>
      <title>Flutter Push Notifications Not Received in Background or When App Is Killed: Fixes</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Wed, 28 Oct 2026 06:37:22 +0000</pubDate>
      <link>https://dev.to/notifysphere/flutter-push-notifications-not-received-in-background-or-when-app-is-killed-fixes-j3a</link>
      <guid>https://dev.to/notifysphere/flutter-push-notifications-not-received-in-background-or-when-app-is-killed-fixes-j3a</guid>
      <description>&lt;p&gt;Your Flutter app gets push notifications while it's open, but nothing shows up once it's in the background or closed. This is one of the most common Firebase Cloud Messaging problems, and it almost always comes down to a handful of causes. Here they are, from most to least likely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  The background handler is a &lt;strong&gt;top-level function&lt;/strong&gt; with &lt;code&gt;@pragma('vm:entry-point')&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;FirebaseMessaging.onBackgroundMessage()&lt;/code&gt; is registered &lt;strong&gt;before&lt;/strong&gt; &lt;code&gt;runApp()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  The message has a &lt;strong&gt;notification&lt;/strong&gt; block, or is data-only with &lt;strong&gt;high priority&lt;/strong&gt; (Android) and &lt;code&gt;content-available&lt;/code&gt; (iOS).&lt;/li&gt;
&lt;li&gt;  Notification permission is granted (Android 13+ and iOS both ask).&lt;/li&gt;
&lt;li&gt;  On iOS: &lt;strong&gt;Push Notifications&lt;/strong&gt; and &lt;strong&gt;Background Modes → Remote notifications&lt;/strong&gt; are enabled, and the APNs key is uploaded to Firebase.&lt;/li&gt;
&lt;li&gt;  You're testing on a real device in a &lt;strong&gt;release or profile build&lt;/strong&gt;, and the app wasn't force-stopped.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Set up the background handler correctly
&lt;/h2&gt;

&lt;p&gt;When your app isn't in the foreground, &lt;code&gt;firebase_messaging&lt;/code&gt; runs your handler in a separate Dart isolate. That only works if Flutter can find the function by itself, so it has to be a top-level function (not inside a class) and marked as an entry point. Otherwise tree shaking in release builds can remove it, and messages silently do nothing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:firebase_core/firebase_core.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:firebase_messaging/firebase_messaging.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Must be a top-level function, not a class method or closure&lt;/span&gt;
&lt;span class="nd"&gt;@pragma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'vm:entry-point'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;firebaseMessagingBackgroundHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RemoteMessage&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Runs in its own isolate, so initialise Firebase again here&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Firebase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="n"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Background message: &lt;/span&gt;&lt;span class="si"&gt;${message.messageId}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;WidgetsFlutterBinding&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ensureInitialized&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Firebase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Register before runApp()&lt;/span&gt;
  &lt;span class="n"&gt;FirebaseMessaging&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onBackgroundMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;firebaseMessagingBackgroundHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="n"&gt;runApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the handler runs in its own isolate, it can't touch your widgets, providers or in-memory state. If you use other Firebase services inside it, call &lt;code&gt;Firebase.initializeApp()&lt;/code&gt; there too.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Send the right kind of message
&lt;/h2&gt;

&lt;p&gt;FCM has two kinds of messages, and they behave very differently in the background:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Notification messages&lt;/strong&gt; (with a &lt;code&gt;notification&lt;/code&gt; block) are displayed by the operating system itself when your app is in the background or closed. Your Dart code doesn't have to run for the user to see them. This is what you want for anything user-facing.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Data-only messages&lt;/strong&gt; (just a &lt;code&gt;data&lt;/code&gt; block) display nothing on their own. They wake your background handler, and only if the platform agrees to deliver them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a notification the user must see, send something like this through the FCM HTTP v1 API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DEVICE_FCM_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"notification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Your order is out for delivery"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Arriving in about 20 minutes"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"orderId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4821"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"notification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"channel_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high_importance"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"aps"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"sound"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you really need a silent data-only message, mark it high priority on Android and as a background push on iOS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DEVICE_FCM_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sync"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"orderId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4821"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-push-type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"background"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"aps"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"content-available"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can build and check both payloads with our free &lt;a href="https://notifysphere.net/tools/fcm-payload-builder" rel="noopener noreferrer"&gt;FCM payload builder&lt;/a&gt;, which also gives you the cURL command.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Ask for notification permission
&lt;/h2&gt;

&lt;p&gt;Since Android 13, apps need the &lt;code&gt;POST_NOTIFICATIONS&lt;/code&gt; runtime permission, and iOS has always needed one. Without it, messages are delivered to the device but never shown. Ask once, at a sensible moment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;FirebaseMessaging&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;requestPermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nl"&gt;alert:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;badge:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;sound:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Permission: &lt;/span&gt;&lt;span class="si"&gt;${settings.authorizationStatus}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the status comes back as &lt;code&gt;denied&lt;/code&gt;, the system won't show the dialog again, so point the user to the app's notification settings instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Android: battery savers and force stop
&lt;/h2&gt;

&lt;p&gt;If notifications arrive on a Pixel but not on some Xiaomi, Oppo, Vivo, Realme, OnePlus or Samsung phones, the phone's battery optimisation is likely stopping your app in the background. Things to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Force stop&lt;/strong&gt; from Settings blocks every FCM message until the user opens the app again. A normal swipe from recents shouldn't, but some brands treat it like a force stop.&lt;/li&gt;
&lt;li&gt;  Use &lt;strong&gt;high priority&lt;/strong&gt; for time-sensitive messages. Normal priority can be delayed while the phone is in Doze mode.&lt;/li&gt;
&lt;li&gt;  Create a &lt;strong&gt;notification channel with high importance&lt;/strong&gt; and send its &lt;code&gt;channel_id&lt;/code&gt;, or the notification may arrive silently without a heads-up banner.&lt;/li&gt;
&lt;li&gt;  For testing, set the app's battery usage to &lt;strong&gt;Unrestricted&lt;/strong&gt; and turn on Autostart where the phone has it. You can't do this for your users, but it confirms the cause.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. iOS: capabilities, APNs and how the app was closed
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  In Xcode, under Signing &amp;amp; Capabilities, add &lt;strong&gt;Push Notifications&lt;/strong&gt; and &lt;strong&gt;Background Modes&lt;/strong&gt; with &lt;em&gt;Remote notifications&lt;/em&gt; ticked.&lt;/li&gt;
&lt;li&gt;  Upload your APNs authentication key in the Firebase console (Project settings → Cloud Messaging). Without it, nothing reaches iOS at all. The &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push guide&lt;/a&gt; walks through it.&lt;/li&gt;
&lt;li&gt;  Background data messages are throttled by iOS and aren't delivered at all if the user swiped the app away. Notification messages are still shown in that case.&lt;/li&gt;
&lt;li&gt;  If you see &lt;code&gt;apns-token-not-set&lt;/code&gt;, the device never got an APNs token. See &lt;a href="https://notifysphere.net/blog/no-apns-token-specified-before-fetching-fcm-token" rel="noopener noreferrer"&gt;how to fix the APNs token error&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Test the right way
&lt;/h2&gt;

&lt;p&gt;Debug builds behave differently from what your users run. When you stop the app from your IDE, the process is killed in a way that real users never do, and background messages may not arrive. Test background and terminated states on a real device with &lt;code&gt;flutter run --release&lt;/code&gt; (or a profile build), close the app the way a user would, then send a message.&lt;/p&gt;

&lt;p&gt;To handle taps, use &lt;code&gt;FirebaseMessaging.onMessageOpenedApp&lt;/code&gt; for a tap while the app is in the background, and &lt;code&gt;FirebaseMessaging.instance.getInitialMessage()&lt;/code&gt; for a tap that launched the app from closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want this handled for you?
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;notifySphere Flutter SDK&lt;/a&gt; handles token registration and wires your background handler in at startup, and it tracks delivery and opens for every notification, so you can see whether a message reached the phone or was dropped on the way. It's free up to 1,000 monthly active users. Compare it with other options on our &lt;a href="https://notifysphere.net/vs/onesignal-alternative" rel="noopener noreferrer"&gt;OneSignal alternatives&lt;/a&gt; page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why do Flutter notifications work in the foreground but not in the background?
&lt;/h3&gt;

&lt;p&gt;Usually one of four things: the background handler isn't a top-level function marked &lt;a class="mentioned-user" href="https://dev.to/pragma"&gt;@pragma&lt;/a&gt;('vm:entry-point'), it's registered after runApp(), the message is data-only without high priority, or the phone's battery saver is stopping your app. Fix them in that order.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does onBackgroundMessage not get called on iOS?
&lt;/h3&gt;

&lt;p&gt;For a data-only message, iOS needs content-available: 1 in the aps payload and the Background Modes capability with Remote notifications enabled. Even then iOS throttles background messages and won't deliver them if the user swiped the app away. For anything the user must see, send a notification payload instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do push notifications arrive if the user force-stops or swipes away the app?
&lt;/h3&gt;

&lt;p&gt;On Android, force stop from Settings blocks all FCM messages until the user opens the app again; a normal swipe from recents does not, except on some phone brands with aggressive battery savers. On iOS, notification messages are still shown after a swipe, but background data messages are not delivered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I update the UI from onBackgroundMessage?
&lt;/h3&gt;

&lt;p&gt;No. The background handler runs in a separate isolate with no access to your widgets or app state. Save what you need (for example with shared_preferences) and read it when the app opens, or use onMessageOpenedApp and getInitialMessage to react to taps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why are notifications not showing when the app is open?
&lt;/h3&gt;

&lt;p&gt;That's expected. In the foreground, Android doesn't display FCM notifications on its own, so you show them yourself with flutter_local_notifications. On iOS, call setForegroundNotificationPresentationOptions(alert: true, badge: true, sound: true).&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/flutter-push-notifications-not-received-in-background" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>flutter</category>
    </item>
    <item>
      <title>React Native Push Notifications: The Complete Guide for Android and iOS</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Thu, 22 Oct 2026 05:35:22 +0000</pubDate>
      <link>https://dev.to/notifysphere/react-native-push-notifications-a-step-by-step-guide-aap</link>
      <guid>https://dev.to/notifysphere/react-native-push-notifications-a-step-by-step-guide-aap</guid>
      <description>&lt;p&gt;Push notifications in React Native come down to three pieces: Firebase Cloud Messaging (FCM) to deliver messages, native setup on Android and iOS, and JavaScript that registers the device and reacts when a notification arrives or is tapped. This guide walks through all of it with the notifySphere React Native SDK, including the parts most tutorials skip: what happens when the app is closed, opening the right screen from a tap, notification channels, attribution and signing out on a shared phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  How push notifications work in React Native
&lt;/h2&gt;

&lt;p&gt;When your app starts, it asks Firebase for a push token: a long string that identifies this app on this device. Your app sends the token to a server, here notifySphere, together with the user it belongs to. When you send a campaign, the server asks FCM to deliver it. FCM reaches Android devices directly and iPhones through Apple Push Notification service (APNs). One Firebase project covers both platforms.&lt;/p&gt;

&lt;p&gt;React Native adds one twist. Your JavaScript only runs while the app is alive. When the app is in the background or closed, the operating system shows the notification on its own, and React Native can wake a small headless JavaScript task to handle the message. That task only knows about code that runs at the top of &lt;code&gt;index.js&lt;/code&gt;, which is why the order of setup matters so much.&lt;/p&gt;

&lt;p&gt;The SDK takes care of most of the plumbing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  asking for the notification permission on Android 13+ and iOS;&lt;/li&gt;
&lt;li&gt;  getting the FCM token (and on iOS, waiting until the APNs token is ready first);&lt;/li&gt;
&lt;li&gt;  registering the device with your user ID, profile fields and tags, and only calling the API again when the token or user details change;&lt;/li&gt;
&lt;li&gt;  re-registering automatically when Firebase rotates the token;&lt;/li&gt;
&lt;li&gt;  showing notifications while the app is open, and creating Android notification channels;&lt;/li&gt;
&lt;li&gt;  sending delivery and tap receipts, and reading the install referrer for attribution on Android.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You handle the native project setup, the background handler, and what your app does when a user taps.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  React Native 0.70 or newer, in a bare project or an Expo development build (not Expo Go).&lt;/li&gt;
&lt;li&gt;  A Firebase project with Cloud Messaging enabled, and an APNs authentication key uploaded to it for iOS.&lt;/li&gt;
&lt;li&gt;  A notifySphere app with an App ID and API token, and your Firebase service account uploaded under &lt;strong&gt;Settings → Messaging&lt;/strong&gt; (see &lt;a href="https://notifysphere.net/docs/firebase-credentials" rel="noopener noreferrer"&gt;Firebase credentials&lt;/a&gt;). notifySphere is free up to 1,000 monthly active users.&lt;/li&gt;
&lt;li&gt;  A physical iPhone for iOS testing. Push doesn't work on the iOS Simulator.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Install the SDK and its peer dependencies
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install react-native-notify-sphere
npm install @react-native-firebase/app @react-native-firebase/messaging
npm install @notifee/react-native
npm install @react-native-async-storage/async-storage@^1.23.1
npm install react-native-device-info react-native-install-referrer
&lt;span class="nb"&gt;cd&lt;/span&gt; ios &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pod install &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each peer dependency has one job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;@react-native-firebase/app&lt;/code&gt; and &lt;code&gt;/messaging&lt;/code&gt;: the push token and incoming messages.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;@notifee/react-native&lt;/code&gt;: drawing notifications while the app is open, and Android channels.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;@react-native-async-storage/async-storage&lt;/code&gt;: remembering the token and subscription between launches. Pin it to v1; v2 needs a custom Maven repository.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;react-native-device-info&lt;/code&gt;: device model, OS version and app version for your user list.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;react-native-install-referrer&lt;/code&gt;: reading the Play Store referrer so installs are credited to campaigns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Set up Android
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Download &lt;code&gt;google-services.json&lt;/code&gt; from the Firebase console into &lt;code&gt;android/app/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Add the Google Services Gradle plugin:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gradle"&gt;&lt;code&gt;&lt;span class="c1"&gt;// android/build.gradle&lt;/span&gt;
&lt;span class="n"&gt;buildscript&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;classpath&lt;/span&gt; &lt;span class="s2"&gt;"com.google.gms:google-services:4.4.0"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// android/app/build.gradle (last line of the file)&lt;/span&gt;
&lt;span class="n"&gt;apply&lt;/span&gt; &lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"com.google.gms.google-services"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt; Declare the permissions and the default notification icon in your manifest:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- android/app/src/main/AndroidManifest.xml --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.POST_NOTIFICATIONS"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.INTERNET"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.VIBRATE"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;application&lt;/span&gt; &lt;span class="na"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Icon Android uses when it shows a push while your app is in the background or closed --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta-data&lt;/span&gt;
    &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"com.google.firebase.messaging.default_notification_icon"&lt;/span&gt;
    &lt;span class="na"&gt;android:resource&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"@drawable/ic_notification"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/application&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt; Add &lt;code&gt;ic_notification.png&lt;/code&gt; to &lt;code&gt;android/app/src/main/res/drawable/&lt;/code&gt;. It must be a white shape on a transparent background. Android draws the small icon as a single colour, so a full-colour app icon shows up as a grey or white square.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You don't need to add a default channel yourself. The SDK's own manifest sets &lt;code&gt;channel_default&lt;/code&gt; as Firebase's default channel, and the SDK creates that channel with high importance and the default sound on first launch. The &lt;a href="https://notifysphere.net/blog/android-13-notification-permission" rel="noopener noreferrer"&gt;Android 13 notification permission guide&lt;/a&gt; explains the permission prompt in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Set up iOS
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Download &lt;code&gt;GoogleService-Info.plist&lt;/code&gt; from Firebase and drag it into your Xcode project, with “Copy items if needed” checked.&lt;/li&gt;
&lt;li&gt; Under &lt;strong&gt;Signing &amp;amp; Capabilities&lt;/strong&gt;, add &lt;strong&gt;Push Notifications&lt;/strong&gt; and &lt;strong&gt;Background Modes → Remote notifications&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; In the Apple Developer portal, create an APNs authentication key (.p8) and upload it in Firebase under &lt;strong&gt;Project settings → Cloud Messaging&lt;/strong&gt;. Without it, Firebase can't reach iPhones and you get errors like &lt;a href="https://notifysphere.net/blog/no-apns-token-specified-before-fetching-fcm-token" rel="noopener noreferrer"&gt;“No APNs token specified”&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; Configure Firebase and the notification centre delegate in your AppDelegate:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight objective_c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ios/YourApp/AppDelegate.mm&lt;/span&gt;
&lt;span class="cp"&gt;#import &amp;lt;Firebase.h&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;#import &amp;lt;UserNotifications/UserNotifications.h&amp;gt;&lt;/span&gt;

&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UIApplication&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;
    &lt;span class="n"&gt;didFinishLaunchingWithOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;NSDictionary&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;launchOptions&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;FIRApp&lt;/span&gt; &lt;span class="n"&gt;defaultApp&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;FIRApp&lt;/span&gt; &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;UNUserNotificationCenter&lt;/span&gt; &lt;span class="n"&gt;currentNotificationCenter&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delegate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// ...the rest of your existing setup&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;YES&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Show banners, sound and badge even when the app is open&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;userNotificationCenter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UNUserNotificationCenter&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;center&lt;/span&gt;
       &lt;span class="n"&gt;willPresentNotification&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UNNotification&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;notification&lt;/span&gt;
         &lt;span class="n"&gt;withCompletionHandler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UNNotificationPresentationOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;completionHandler&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;completionHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;UNNotificationPresentationOptionSound&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
                    &lt;span class="nc"&gt;UNNotificationPresentationOptionAlert&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
                    &lt;span class="nc"&gt;UNNotificationPresentationOptionBadge&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;willPresentNotification&lt;/code&gt; method decides whether iOS shows a banner while your app is open. Leave it out and foreground pushes arrive silently. The &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push guide&lt;/a&gt; covers APNs keys and certificates step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Register the background handler
&lt;/h2&gt;

&lt;p&gt;When a push arrives while the app is in the background or closed, React Native starts a headless JavaScript task that runs &lt;code&gt;index.js&lt;/code&gt; and nothing else: no components, no &lt;code&gt;useEffect&lt;/code&gt;, no &lt;code&gt;initialize()&lt;/code&gt;. Firebase needs its background handler to exist at that moment, so register it synchronously at the top of &lt;code&gt;index.js&lt;/code&gt;, before &lt;code&gt;registerComponent()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// index.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;AppRegistry&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-native"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./src/App"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;appName&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./app.json"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-native-notify-sphere"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;APP_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;API_TOKEN&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./src/config"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Must run synchronously, before registerComponent().&lt;/span&gt;
&lt;span class="c1"&gt;// Not inside .then(), setTimeout() or an async function.&lt;/span&gt;
&lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setBackgroundHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;APP_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;API_TOKEN&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;AppRegistry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerComponent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pass &lt;code&gt;appId&lt;/code&gt; here. In a closed app, &lt;code&gt;initialize()&lt;/code&gt; hasn't run, so this is the only place the SDK can learn where to send delivery receipts. If you wrap this call in &lt;code&gt;AsyncStorage.getItem().then(...)&lt;/code&gt; or a timeout, it registers after the message has already been handed over, and the receipt is lost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Register the user and device
&lt;/h2&gt;

&lt;p&gt;Call &lt;code&gt;initialize()&lt;/code&gt; once you know who the user is. It asks for permission, gets the FCM token, registers the device and returns the subscription ID. It's safe to call on every launch: the SDK stores a fingerprint of the token and user details, and only calls the API when something changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/App.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Platform&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-native"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react-native-notify-sphere"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;APP_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;API_TOKEN&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./config"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;PUSH_TYPE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Platform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OS&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"android"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"AndroidPush"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"IOSPush"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useCurrentUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// your own auth state&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;applicationUserId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;PUSH_TYPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;APP_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;API_TOKEN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// a string, so leading zeros and +91 survive&lt;/span&gt;
      &lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;__DEV__&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Push setup failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// ...render your app&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few details from the SDK source that are worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Permission:&lt;/strong&gt; on Android 13+ the SDK requests &lt;code&gt;POST_NOTIFICATIONS&lt;/code&gt; and stops waiting after 10 seconds. On iOS it asks through Firebase and treats provisional (quiet) permission as granted. If the user says no, the device still registers, but nothing will be shown until they turn notifications on in settings. If you'd rather explain the value first, show your own screen and call &lt;code&gt;initialize()&lt;/code&gt; after it.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Phone numbers&lt;/strong&gt; are strings, so country codes and leading zeros aren't lost. They're used for WhatsApp messages to the same user.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;HTTPS only:&lt;/strong&gt; the SDK refuses any plain &lt;code&gt;http://&lt;/code&gt; endpoint, because the request carries the token and profile fields.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Token rotation&lt;/strong&gt; is handled for you: when Firebase issues a new token, the SDK re-registers the device with the same user. Expired tokens are cleaned up on the server; see &lt;a href="https://notifysphere.net/blog/fcm-unregistered-token" rel="noopener noreferrer"&gt;FCM UNREGISTERED tokens&lt;/a&gt; for why that matters for your bill.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Foreground, background and closed: what actually happens
&lt;/h2&gt;

&lt;p&gt;Most “push works sometimes” bugs come from not knowing which code runs in which state. Here is the behaviour of SDK 1.3:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;App state&lt;/th&gt;
&lt;th&gt;Who shows the notification&lt;/th&gt;
&lt;th&gt;onNotification() type&lt;/th&gt;
&lt;th&gt;Delivery receipt&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Open (foreground)&lt;/td&gt;
&lt;td&gt;The SDK draws it with Notifee, so it shows as a banner like any other push&lt;/td&gt;
&lt;td&gt;received when it arrives, opened when tapped&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;In the background&lt;/td&gt;
&lt;td&gt;Android or iOS shows it from the notification block, without running your JavaScript&lt;/td&gt;
&lt;td&gt;opened when tapped&lt;/td&gt;
&lt;td&gt;Only for data-only messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Closed (terminated)&lt;/td&gt;
&lt;td&gt;The operating system shows it, same as background&lt;/td&gt;
&lt;td&gt;initial when tapped and the app starts&lt;/td&gt;
&lt;td&gt;Only for data-only messages, and only if setBackgroundHandler() runs in index.js&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two consequences. First, you never get duplicate notifications: since version 1.2.5 the background handler only sends the delivery receipt and leaves display to the operating system. Second, when a push carries a &lt;code&gt;notification&lt;/code&gt; block, Android shows it in the background without running your JavaScript, so delivery receipts from background and closed states only come from data-only messages. Taps are tracked in every state. If notifications go missing when the app is closed on some Android phones, battery savers may be the cause; see &lt;a href="https://notifysphere.net/blog/flutter-push-notifications-not-received-in-background" rel="noopener noreferrer"&gt;why push notifications don't arrive in the background&lt;/a&gt; (written for Flutter, but the Android causes are the same).&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling taps and opening the right screen
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;onNotification()&lt;/code&gt; gives you one callback for every event, with a type that says what happened:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;received&lt;/code&gt;: a push arrived while the app was open. Nothing was tapped.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;opened&lt;/code&gt;: the user tapped a push and the app came back from the background, or tapped a banner the SDK showed while the app was open.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;initial&lt;/code&gt;: the user tapped a push and the app started from closed.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;press&lt;/code&gt;: the user tapped a notification that Notifee displayed while the app was in the background.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a tap can arrive as any of the last three. A common mistake is to only handle one of them and wonder why taps from a closed app do nothing. Send the screen and IDs in the push's data and route on them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createNavigationContainerRef&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@react-navigation/native"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;navigationRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createNavigationContainerRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// type: "received" | "opened" | "initial" | "press"&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"received"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// arrived while the app was open, not tapped&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// e.g. "Order"&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;         &lt;span class="c1"&gt;// any key you sent in data&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;go&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;navigationRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;navigate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// A cold start ("initial") can fire before the navigator is ready&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;navigationRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isReady&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;go&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nb"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;go&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each callback receives the title, body, data, image and sound, so you can also show an in-app message instead of navigating.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a push looks like
&lt;/h2&gt;

&lt;p&gt;notifySphere sends mixed messages: a &lt;code&gt;notification&lt;/code&gt; block so the operating system can show the push when your app isn't running, and a &lt;code&gt;data&lt;/code&gt; block with tracking and routing information. When you compose a campaign in the dashboard you only fill in the title, text, image and your own key-value data; notifySphere builds the rest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"notification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Your order is out"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Arriving today by 6 PM"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"notification_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"set-by-notifysphere"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"screen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"orderId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ORD123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"imageUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com/van.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"channelId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"orders"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"sound"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"high"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every value in &lt;code&gt;data&lt;/code&gt; is a string. If you need a number or an object in the app, convert it there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Images, sounds and Android channels
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Images.&lt;/strong&gt; When the app is open, the SDK shows the image as a large picture on Android and as an attachment on iOS. In the background, Android shows the image from the notification block by itself. iOS only shows images in the background if your app has a Notification Service Extension that downloads the image before display; the React Native SDK doesn't add one for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Channels.&lt;/strong&gt; Android 8 and later put every notification in a channel, and the user can mute each channel separately. Channels you configure in notifySphere (name, importance, sound, vibration, light and lock-screen visibility) are sent to the device when it registers, created by the SDK, and cached so they exist even before the app opens next time. A push with &lt;code&gt;channelId&lt;/code&gt; in its data uses that channel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom sounds.&lt;/strong&gt; Put the sound file in &lt;code&gt;android/app/src/main/res/raw/&lt;/code&gt; on Android and in the app bundle on iOS, and refer to it by name without the extension. One Android rule catches everyone: once a channel exists, its sound can't be changed. If you change a sound, use a new channel ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tags and segments
&lt;/h2&gt;

&lt;p&gt;Tags are key-value pairs on the user, such as plan, city, language or the date of the last order. In the dashboard you build segments from them (users in Pune on the free plan, users who haven't ordered in 30 days) and send campaigns or start Automation flows for each segment. Pass tags in &lt;code&gt;initialize()&lt;/code&gt;, or update them later without re-registering:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateTags&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;applicationUserId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;PUSH_TYPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Pune"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastOrderAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use strings for values, and use the same key names on Android and iOS so one segment covers both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conversions and campaign attribution
&lt;/h2&gt;

&lt;p&gt;Opens are only half the story. To know whether a push, a WhatsApp message or a &lt;a href="https://notifysphere.net/deep-linking-onelink" rel="noopener noreferrer"&gt;TrackerLink&lt;/a&gt; led to a purchase, send the conversion as an event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// After a purchase, booking or signup inside the app&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"purchase"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ORD123"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Events show up in &lt;a href="https://notifysphere.net/docs/attribution" rel="noopener noreferrer"&gt;attribution campaigns&lt;/a&gt; and &lt;a href="https://notifysphere.net/docs/funnels" rel="noopener noreferrer"&gt;funnels&lt;/a&gt;, and you can use them as triggers or exit rules in &lt;a href="https://notifysphere.net/docs/automation" rel="noopener noreferrer"&gt;Automation&lt;/a&gt;. Installs are credited too. On Android, when someone installs from a TrackerLink, the SDK reads the Play install referrer on first launch and adds the click ID and campaign to the user's tags, so the match is exact. On iOS there is no install referrer, so notifySphere matches the first app open to a recent click from the same IP address or device within the attribution window (7 days by default), which is less precise. &lt;a href="https://notifysphere.net/blog/deferred-deep-linking-explained" rel="noopener noreferrer"&gt;Deferred deep linking explained&lt;/a&gt; covers how both work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sign-out and account switching
&lt;/h2&gt;

&lt;p&gt;A push token belongs to the device, not the user. If someone signs out and another person signs in on the same phone, the first user's notifications can keep arriving unless you detach the device. &lt;code&gt;destroy()&lt;/code&gt; only removes local listeners. On sign-out, call &lt;code&gt;logout()&lt;/code&gt;: it unsubscribes the device on the server, deletes the FCM token and clears the cached user data. Then call &lt;code&gt;initialize()&lt;/code&gt; with the new user's ID and tags when they sign in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// On sign-out: detach this device from the user (SDK 1.3.0+)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;onSignOut&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// never throws&lt;/span&gt;
  &lt;span class="c1"&gt;// ...then clear your own session&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// On sign-in: initialize() again with the new user's ID and tags&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test it on one phone, because foreground, background and closed-app checks won't catch this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Sign in as user A and send a push to A. It should arrive.&lt;/li&gt;
&lt;li&gt; Sign out, then send to A again. Nothing should arrive on this phone.&lt;/li&gt;
&lt;li&gt; Sign in as user B. A push to B should arrive; a push to A still shouldn't.&lt;/li&gt;
&lt;li&gt; Check that B's tags and segments carry nothing over from A.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks to Dave Kurian, who suggested this test in the comments of this guide on &lt;a href="https://dev.to/notifysphere/react-native-push-notifications-a-step-by-step-guide-aap"&gt;DEV&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Test on real devices
&lt;/h2&gt;

&lt;p&gt;Run a release-like build on a physical Android phone and a physical iPhone, accept the permission, then send a test push from the dashboard. Go through this list on both:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; App open: a banner appears and &lt;code&gt;onNotification()&lt;/code&gt; fires with &lt;code&gt;received&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; App in the background: the notification appears; tapping it opens the right screen.&lt;/li&gt;
&lt;li&gt; App swiped away: the notification appears; tapping it starts the app on the right screen.&lt;/li&gt;
&lt;li&gt; A push with an image, and one on a custom channel, look the way you expect.&lt;/li&gt;
&lt;li&gt; Delivered and opened counts move in the campaign report.&lt;/li&gt;
&lt;li&gt; The sign-out test above passes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Turn on &lt;code&gt;debug: true&lt;/code&gt; and watch &lt;code&gt;adb logcat | grep NotifySphere&lt;/code&gt; on Android. In a closed app the SDK logs a line when the background handler fires. If that line never appears, the handler isn't registered in time.&lt;/p&gt;

&lt;p&gt;dashboard.notifysphere.net&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnuyrdwt1hs8ukp34d1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnuyrdwt1hs8ukp34d1f.png" alt="notifySphere dashboard with active subscriptions, app subscribers, monthly active users, and push sends"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once devices register, subscriptions, monthly active users, and push sends show up on the dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Usual cause and fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Nothing arrives on iOS&lt;/td&gt;
&lt;td&gt;You're on the Simulator, the Push Notifications capability is missing, or no APNs key is uploaded to Firebase.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nothing arrives on Android 13+&lt;/td&gt;
&lt;td&gt;The user denied the notification permission, or the prompt never appeared because POST_NOTIFICATIONS is missing from the manifest.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works when open, not when closed&lt;/td&gt;
&lt;td&gt;setBackgroundHandler() runs too late, usually inside a promise in index.js, or the appId isn't passed to it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android shows a grey or white square&lt;/td&gt;
&lt;td&gt;The small icon isn't a white shape on a transparent background, or the default_notification_icon entry is missing.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sound doesn't change after you edit a channel&lt;/td&gt;
&lt;td&gt;Android channels can't be changed after creation. Use a new channel ID, or reinstall the app while testing.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;401 from the API&lt;/td&gt;
&lt;td&gt;The apiKey is missing in initialize() or setBackgroundHandler().&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Build fails on AsyncStorage&lt;/td&gt;
&lt;td&gt;Use @react-native-async-storage/async-storage@^1.23.1. Version 2 needs a Maven repository most projects don't have.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A signed-out user still gets pushes&lt;/td&gt;
&lt;td&gt;You called destroy() instead of logout() on sign-out.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For errors your server gets back from FCM or APNs, see the &lt;a href="https://notifysphere.net/blog/topic/push" rel="noopener noreferrer"&gt;push notification error guides&lt;/a&gt;, including &lt;a href="https://notifysphere.net/blog/fcm-sender-id-mismatch" rel="noopener noreferrer"&gt;SENDER_ID_MISMATCH&lt;/a&gt; and &lt;a href="https://notifysphere.net/blog/apns-bad-device-token" rel="noopener noreferrer"&gt;BadDeviceToken&lt;/a&gt;. Pushes arriving late rather than not at all? Read &lt;a href="https://notifysphere.net/blog/real-time-push-notification-sdk" rel="noopener noreferrer"&gt;why push notifications arrive late&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need Firebase for React Native push notifications?
&lt;/h3&gt;

&lt;p&gt;On Android, yes: Firebase Cloud Messaging is how Google delivers pushes to apps. On iOS, Apple Push Notification service does the delivery, but using Firebase on both platforms means one token format and one sending API. The notifySphere React Native SDK uses @react-native-firebase/messaging on both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does this work with Expo?
&lt;/h3&gt;

&lt;p&gt;The SDK relies on native modules (Firebase, Notifee, install referrer), so it does not run in Expo Go. It needs a bare React Native project, or an Expo project with a development build that includes those native modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why don't notifications show when my React Native app is open?
&lt;/h3&gt;

&lt;p&gt;Firebase doesn't display pushes while the app is in the foreground. The notifySphere SDK draws them itself with Notifee, so they appear as normal banners. On iOS, the willPresentNotification method in AppDelegate also has to return the alert, sound and badge options.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I open a specific screen when the user taps a notification?
&lt;/h3&gt;

&lt;p&gt;Put the screen name and any IDs in the push's data, then handle the opened, initial and press types in onNotification() and navigate with a navigation ref. The initial type fires on a cold start, so wait until the navigator is ready.&lt;/p&gt;

&lt;h3&gt;
  
  
  When does the notification permission prompt appear?
&lt;/h3&gt;

&lt;p&gt;When you call initialize(). On Android 13 and later the SDK asks for POST_NOTIFICATIONS and gives up after 10 seconds without an answer. On iOS it asks through Firebase and treats provisional (quiet) permission as granted. Older Android versions don't need a prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know a push was delivered?
&lt;/h3&gt;

&lt;p&gt;The SDK sends a delivery receipt when a push arrives in the foreground, and when a data-only push arrives in the background or while the app is closed. Taps are tracked in every state. Delivery and open counts show up in the campaign report.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I track which campaign brought an install?
&lt;/h3&gt;

&lt;p&gt;Yes. On Android the SDK reads the Play install referrer on first launch and saves the TrackerLink click and campaign in the user's tags, so the install and later events are credited exactly. On iOS, notifySphere matches the first app open to a recent click by IP address or device, which is less precise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://notifysphere.net/docs/react-native" rel="noopener noreferrer"&gt;React Native SDK reference&lt;/a&gt; lists every method and option. Building in Flutter as well? The &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;Flutter push notifications guide&lt;/a&gt; covers the same ground. Comparing providers? Read &lt;a href="https://notifysphere.net/vs/onesignal-alternative" rel="noopener noreferrer"&gt;notifySphere vs OneSignal and other OneSignal alternatives&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>Flutter Push Notifications: The Complete Guide for Android and iOS</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Wed, 14 Oct 2026 11:42:07 +0000</pubDate>
      <link>https://dev.to/notifysphere/flutter-push-notifications-a-step-by-step-guide-34f1</link>
      <guid>https://dev.to/notifysphere/flutter-push-notifications-a-step-by-step-guide-34f1</guid>
      <description>&lt;p&gt;Flutter push notifications use Firebase Cloud Messaging (FCM) on both Android and iOS. You add the Firebase packages, register the device to get an FCM token, and send messages to that token from a server. Android needs a manifest entry and, on Android 13 and later, a runtime permission. iOS needs an APNs key in Firebase, the Push Notifications capability and, if you want to know whether a notification was delivered while the app was closed, a Notification Service Extension. This guide walks through all of it with &lt;code&gt;flutter_notify_sphere&lt;/code&gt;, then covers the three app states, taps and deep links, images and sounds, attribution, and the errors you're most likely to hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  How push notifications work in Flutter
&lt;/h2&gt;

&lt;p&gt;There are four parties: your Flutter app, Firebase Cloud Messaging, Apple Push Notification service (APNs) for iPhones, and the server that sends the message.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; When the app starts, the Firebase SDK on the phone gets a &lt;strong&gt;registration token&lt;/strong&gt; from FCM. On iOS it first needs an APNs token from Apple.&lt;/li&gt;
&lt;li&gt; The app sends that token to your push server, together with who the user is.&lt;/li&gt;
&lt;li&gt; When you send a campaign, the server calls the FCM API with the token and the message.&lt;/li&gt;
&lt;li&gt; FCM delivers to Android phones directly. For iPhones, FCM hands the message to APNs using the APNs key you uploaded to Firebase.&lt;/li&gt;
&lt;li&gt; The phone shows the notification, or passes it to your app, depending on the app's state.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Two things in that chain catch most people. Tokens change: when a user reinstalls the app or clears its data, the old token stops working, and FCM tells you so with an &lt;a href="https://notifysphere.net/blog/fcm-unregistered-token" rel="noopener noreferrer"&gt;UNREGISTERED&lt;/a&gt; error. And FCM confirming that it accepted a message doesn't mean the phone ever showed it. If you want delivery numbers you can trust, the phone has to report back. That's what the SDK used in this guide does.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Flutter with Dart 3.9 or newer.&lt;/li&gt;
&lt;li&gt;  A Firebase project with your Android and iOS apps added.&lt;/li&gt;
&lt;li&gt;  For iOS: an APNs authentication key (.p8) from your Apple Developer account, uploaded in Firebase → &lt;strong&gt;Project settings → Cloud Messaging&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  A notifySphere app with its App ID and API token, and your Firebase service account JSON uploaded (see &lt;a href="https://notifysphere.net/docs/push-setup" rel="noopener noreferrer"&gt;push setup&lt;/a&gt; and &lt;a href="https://notifysphere.net/docs/firebase-credentials" rel="noopener noreferrer"&gt;Firebase credentials&lt;/a&gt;). It's free up to 1,000 monthly active users.&lt;/li&gt;
&lt;li&gt;  A real Android phone and a real iPhone for testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Add the packages
&lt;/h2&gt;

&lt;p&gt;Add the SDK and the two Firebase packages to &lt;code&gt;pubspec.yaml&lt;/code&gt;, then run &lt;code&gt;flutter pub get&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;flutter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;sdk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;flutter&lt;/span&gt;
  &lt;span class="na"&gt;flutter_notify_sphere&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.2.1&lt;/span&gt;
  &lt;span class="na"&gt;firebase_core&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^4.3.0&lt;/span&gt;
  &lt;span class="na"&gt;firebase_messaging&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^16.1.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;flutter_notify_sphere&lt;/code&gt; 1.2.1 depends on &lt;code&gt;firebase_core ^4.3.0&lt;/code&gt; and &lt;code&gt;firebase_messaging ^16.1.0&lt;/code&gt;. If your app pins older Firebase versions, &lt;code&gt;pub get&lt;/code&gt; fails with “version solving failed”. Upgrade the Firebase packages together; mixing major versions of FlutterFire plugins causes the same error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Set up Android
&lt;/h2&gt;

&lt;p&gt;Download &lt;code&gt;google-services.json&lt;/code&gt; from the Firebase console into &lt;code&gt;android/app/&lt;/code&gt; and apply the Google Services Gradle plugin, as the FlutterFire setup describes. Then add the permissions and the default icon and channel to &lt;code&gt;android/app/src/main/AndroidManifest.xml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.INTERNET"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.POST_NOTIFICATIONS"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"android.permission.VIBRATE"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;application&lt;/span&gt; &lt;span class="na"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta-data&lt;/span&gt;
        &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"com.google.firebase.messaging.default_notification_icon"&lt;/span&gt;
        &lt;span class="na"&gt;android:resource&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"@mipmap/ic_launcher"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta-data&lt;/span&gt;
        &lt;span class="na"&gt;android:name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"com.google.firebase.messaging.default_notification_channel_id"&lt;/span&gt;
        &lt;span class="na"&gt;android:value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"notify_sphere_channel"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/application&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The notification permission.&lt;/strong&gt; Since Android 13, apps must ask the user before showing notifications, and the request only works if &lt;code&gt;POST_NOTIFICATIONS&lt;/code&gt; is in the manifest. You don't need to request it yourself: &lt;code&gt;registerUser()&lt;/code&gt; asks for permission before it gets the token. If the user says no, the device still registers, but nothing is shown. The &lt;a href="https://notifysphere.net/blog/android-13-notification-permission" rel="noopener noreferrer"&gt;Android 13 notification permission guide&lt;/a&gt; covers when to ask and what to do after a denial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The icon.&lt;/strong&gt; Android draws the small notification icon as a single-color silhouette. A full-color launcher icon often shows as a plain white shape, so point &lt;code&gt;default_notification_icon&lt;/code&gt; at a simple, transparent icon once you have one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom sounds.&lt;/strong&gt; Put the sound file in &lt;code&gt;android/app/src/main/res/raw/&lt;/code&gt;, for example &lt;code&gt;custom_sound.mp3&lt;/code&gt;, and enter &lt;code&gt;custom_sound&lt;/code&gt; without the extension in the campaign's sound field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Set up iOS
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;ios/Runner.xcworkspace&lt;/code&gt; in Xcode and add &lt;code&gt;GoogleService-Info.plist&lt;/code&gt; to the Runner folder. Then, under &lt;strong&gt;Signing &amp;amp; Capabilities&lt;/strong&gt; for the Runner target, add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Push Notifications&lt;/strong&gt;, so iOS gives the app an APNs token.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Background Modes&lt;/strong&gt; with &lt;strong&gt;Remote notifications&lt;/strong&gt; and &lt;strong&gt;Background fetch&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;App Groups&lt;/strong&gt; with a group named &lt;code&gt;group.&amp;lt;your.bundle.id&amp;gt;&lt;/code&gt;. The extension in the next step uses it to read the credentials the SDK saves.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If iOS push doesn't work later, this step is usually why. A missing capability gives you &lt;a href="https://notifysphere.net/blog/no-apns-token-specified-before-fetching-fcm-token" rel="noopener noreferrer"&gt;“No APNS token specified”&lt;/a&gt;, and an APNs key problem in Firebase gives you &lt;a href="https://notifysphere.net/blog/fcm-third-party-auth-error" rel="noopener noreferrer"&gt;THIRD_PARTY_AUTH_ERROR&lt;/a&gt; on every iOS send while Android keeps working. The &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push setup guide&lt;/a&gt; goes through the APNs key step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add a Notification Service Extension
&lt;/h2&gt;

&lt;p&gt;This is the step most Flutter push tutorials leave out. When a notification arrives while your app is in the background or closed, iOS shows it without running any of your Dart code. So the app can't report that it arrived, and it can't download an image to attach.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Notification Service Extension&lt;/strong&gt; is a small native target that iOS runs for each incoming notification marked &lt;code&gt;mutable-content&lt;/code&gt;. In Xcode, choose &lt;strong&gt;File → New → Target → Notification Service Extension&lt;/strong&gt; (Swift), name it, for example, &lt;code&gt;ImageNotification&lt;/code&gt;, and give it the &lt;strong&gt;same App Group&lt;/strong&gt; as Runner. Then add &lt;code&gt;NotifySphereExtension.swift&lt;/code&gt; to it and call it from &lt;code&gt;NotificationService.swift&lt;/code&gt;; both files are in the &lt;a href="https://pub.dev/packages/flutter_notify_sphere" rel="noopener noreferrer"&gt;package README&lt;/a&gt;. The extension reads the App ID and API key from the shared App Group, confirms delivery, attaches the image and applies a custom sound.&lt;/p&gt;

&lt;p&gt;Without it, iOS notifications still arrive, but deliveries while the app is closed aren't counted and images don't show.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Initialize the SDK
&lt;/h2&gt;

&lt;p&gt;Initialize Firebase, then the SDK, before &lt;code&gt;runApp&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s1"&gt;'package:firebase_core/firebase_core.dart'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s1"&gt;'package:firebase_messaging/firebase_messaging.dart'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s1"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s1"&gt;'package:flutter_notify_sphere/flutter_notify_sphere.dart'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Must be a top-level function, not a method or a closure&lt;/span&gt;
&lt;span class="nd"&gt;@pragma&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'vm:entry-point'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nc"&gt;Future&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;backgroundMessageHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RemoteMessage&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Runs in a separate isolate: no widgets, no app state. Keep it short.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;navigatorKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GlobalKey&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;NavigatorState&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;WidgetsFlutterBinding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ensureInitialized&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Firebase&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;FlutterNotifySphere&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;showForegroundNotification&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;onForegroundMessage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RemoteMessage&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Push while the app is open: ${message.data}'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;onNotificationClick&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RemoteMessage&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'screen'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;navigatorKey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;currentState&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pushNamed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;backgroundMessageHandler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;backgroundMessageHandler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;useReferral&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// read the TrackerLink install referrer (default true)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;runApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MaterialApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;navigatorKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;navigatorKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;HomeScreen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few rules here save hours later:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;The background handler must be a top-level function&lt;/strong&gt; with &lt;code&gt;@pragma('vm:entry-point')&lt;/code&gt;. It runs in a separate isolate, without your widgets or app state, and the annotation stops the release build from removing it.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Pass your handler to the SDK&lt;/strong&gt; instead of calling &lt;code&gt;FirebaseMessaging.onBackgroundMessage&lt;/code&gt; yourself. The SDK registers its own background handler, which records the delivery and then calls yours.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Navigate through a navigator key.&lt;/strong&gt; A tap that starts the app can arrive before your first screen has a usable &lt;code&gt;BuildContext&lt;/code&gt;. A &lt;code&gt;GlobalKey&amp;lt;NavigatorState&amp;gt;&lt;/code&gt; works from anywhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 6: Register the user and device
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;registerUser()&lt;/code&gt; asks for notification permission, gets the FCM token and sends it to notifySphere with the user's details. Call it once you know who the user is, for example after sign-in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// After login, or on the screen where asking for permission makes sense&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;FlutterNotifySphere&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR_APP_ID'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'YOUR_API_TOKEN'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;userData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s1"&gt;'applicationUserId'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12345&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// your own user ID&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Jane Doe'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'email'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'jane@example.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// Always pass a tags map: the SDK adds the TrackerLink click to it&lt;/span&gt;
    &lt;span class="s1"&gt;'tags'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;dynamic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'plan'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'free'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onFcmToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'FCM token: $token'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onRegistrationComplete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Subscription: $id'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Object&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;debugPrint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Registration failed: $error'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Permission timing matters.&lt;/strong&gt; Because this call shows the permission prompt, calling it on the very first screen means asking before the user knows why. After sign-up, or after the user turns on a feature that needs notifications, is usually better.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Always pass a &lt;code&gt;tags&lt;/code&gt; map&lt;/strong&gt;, even an empty one. If the user installed from a &lt;a href="https://notifysphere.net/deep-linking-onelink" rel="noopener noreferrer"&gt;TrackerLink&lt;/a&gt;, the SDK adds the campaign click to &lt;code&gt;tags&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;On iOS, the SDK waits up to 10 seconds for the APNs token&lt;/strong&gt; before asking for the FCM token. If it never arrives, &lt;code&gt;onFcmToken&lt;/code&gt; gets no token. That almost always means the Push Notifications capability is missing or you're not on a real device.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Nothing is lost before registration.&lt;/strong&gt; If a notification is delivered or tapped before &lt;code&gt;registerUser()&lt;/code&gt; finishes, for example a tap that starts the app, the event is queued and sent once registration completes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Foreground, background and terminated: what happens
&lt;/h2&gt;

&lt;p&gt;Most “push doesn't work” reports are really “push works differently in this app state”. Here is what happens to a notification in each state with this setup:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;App state&lt;/th&gt;
&lt;th&gt;Android&lt;/th&gt;
&lt;th&gt;iOS&lt;/th&gt;
&lt;th&gt;Your code that runs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Foreground (app open)&lt;/td&gt;
&lt;td&gt;Not shown by the system. The SDK shows it as a local notification, with its image, when showForegroundNotification is true.&lt;/td&gt;
&lt;td&gt;Shown, because the SDK sets the foreground presentation options to alert, badge and sound.&lt;/td&gt;
&lt;td&gt;onForegroundMessage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Background (app in memory)&lt;/td&gt;
&lt;td&gt;Shown in the tray by the system.&lt;/td&gt;
&lt;td&gt;Shown by the system.&lt;/td&gt;
&lt;td&gt;Your backgroundMessageHandler, then onNotificationClick on tap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terminated (swiped away or not started)&lt;/td&gt;
&lt;td&gt;Shown by the system, unless the phone's battery settings stop the app.&lt;/td&gt;
&lt;td&gt;Shown by the system. Delivery is confirmed by the Notification Service Extension.&lt;/td&gt;
&lt;td&gt;onNotificationClick when a tap starts the app&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Include a notification block, not data only.&lt;/strong&gt; A message with a top-level &lt;code&gt;notification&lt;/code&gt; block is shown by the system even when your app isn't running. A data-only message depends on your app waking up to show it, which Android battery savers and iOS background limits often prevent. The notifySphere docs recommend mixed payloads: &lt;code&gt;notification&lt;/code&gt; for the system to display, and &lt;code&gt;data&lt;/code&gt; for tracking and routing. If notifications still go missing when the app is closed, work through &lt;a href="https://notifysphere.net/blog/flutter-push-notifications-not-received-in-background" rel="noopener noreferrer"&gt;Flutter push notifications not received in background&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling taps and deep links
&lt;/h2&gt;

&lt;p&gt;A tap can reach your app in two ways. If the app was in the background, Firebase fires &lt;code&gt;onMessageOpenedApp&lt;/code&gt;. If the tap started the app, the message comes from &lt;code&gt;getInitialMessage()&lt;/code&gt;. The SDK listens to both and calls your &lt;code&gt;onNotificationClick&lt;/code&gt; once per tap, so you don't handle the two cases separately.&lt;/p&gt;

&lt;p&gt;On iOS there's a third case that loses taps with plain &lt;code&gt;firebase_messaging&lt;/code&gt;. A push marked &lt;code&gt;content-available&lt;/code&gt; can make iOS start a closed app in the background. Firebase then treats that push as the app's initial notification, so when the user taps it later, neither &lt;code&gt;onMessageOpenedApp&lt;/code&gt; nor the earlier &lt;code&gt;getInitialMessage()&lt;/code&gt; call delivers the tap. The SDK asks again when the app comes to the foreground, so these taps still reach &lt;code&gt;onNotificationClick&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To open a specific screen, put a value in the notification's data, such as &lt;code&gt;screen&lt;/code&gt; or &lt;code&gt;orderId&lt;/code&gt;, and read it in &lt;code&gt;onNotificationClick&lt;/code&gt;, as in the Step 5 example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Images and custom sounds
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Android, app open:&lt;/strong&gt; the SDK downloads the message's &lt;code&gt;imageUrl&lt;/code&gt; and shows it as an expandable big-picture notification, with the campaign's sound.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Android, app in background or closed:&lt;/strong&gt; the system shows the notification itself, using the channel and the default icon from the manifest.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;iOS:&lt;/strong&gt; images and custom sounds come from the Notification Service Extension. No extension, no image.&lt;/li&gt;
&lt;li&gt;  Keep images small and on HTTPS. The extension only has a short time to download them before iOS shows the notification without the image.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tracking conversions and campaigns
&lt;/h2&gt;

&lt;p&gt;Since version 1.2, the Flutter SDK also does attribution with &lt;a href="https://notifysphere.net/deep-linking-onelink" rel="noopener noreferrer"&gt;TrackerLink&lt;/a&gt;. With &lt;code&gt;useReferral: true&lt;/code&gt; (the default), it reads the campaign click on first launch from the Google Play install referrer on Android. (On iOS, where there is no install referrer, notifySphere matches the install to a recent click from the same IP address or device.) The click is saved and sent with the user's tags at registration. After that you can record conversions and change tags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A conversion, for campaign attribution&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;FlutterNotifySphere&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'purchase'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'revenue'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;499&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'order_id'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ORD123'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Change the user's tags without registering again&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;FlutterNotifySphere&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateTags&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;'plan'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'pro'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;postEvent()&lt;/code&gt; needs &lt;code&gt;registerUser()&lt;/code&gt; to have completed; before that it returns &lt;code&gt;false&lt;/code&gt;. &lt;code&gt;updateTags()&lt;/code&gt; merges the new tags into the existing ones. Opening a specific screen from a deep link is still up to your app. Not sure how a link survives the install? &lt;a href="https://notifysphere.net/blog/deferred-deep-linking-explained" rel="noopener noreferrer"&gt;Deferred deep linking explained&lt;/a&gt; covers both platforms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Test on real devices
&lt;/h2&gt;

&lt;p&gt;Send a test campaign from the dashboard and check each state on both platforms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;App open:&lt;/strong&gt; a notification appears and &lt;code&gt;onForegroundMessage&lt;/code&gt; fires.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;App in background:&lt;/strong&gt; the notification is in the tray; tapping it fires &lt;code&gt;onNotificationClick&lt;/code&gt; and the Clicked count goes up.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;App swiped away:&lt;/strong&gt; the notification still shows. On iOS, the Delivered count goes up, which proves the extension works.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Tap from closed:&lt;/strong&gt; the app opens on the right screen.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;dashboard.notifysphere.net&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnuyrdwt1hs8ukp34d1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnuyrdwt1hs8ukp34d1f.png" alt="notifySphere dashboard with active subscriptions, app subscribers, monthly active users, and push sends"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Registered Flutter devices appear as app subscribers, with sends, deliveries and clicks per campaign.&lt;/p&gt;

&lt;p&gt;Building the payload yourself instead of sending from the dashboard? The &lt;a href="https://notifysphere.net/tools/fcm-payload-builder" rel="noopener noreferrer"&gt;FCM payload builder&lt;/a&gt; creates the HTTP v1 JSON, and the &lt;a href="https://notifysphere.net/tools/push-notification-preview" rel="noopener noreferrer"&gt;push notification preview&lt;/a&gt; shows where the text gets cut on Android and iPhone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Usual cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;version solving failed&lt;/td&gt;
&lt;td&gt;Firebase packages older than the SDK needs&lt;/td&gt;
&lt;td&gt;Use firebase_core ^4.3.0 and firebase_messaging ^16.1.0 or newer in the same major version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No permission prompt on Android 13+&lt;/td&gt;
&lt;td&gt;POST_NOTIFICATIONS missing from the manifest&lt;/td&gt;
&lt;td&gt;Add the permission; the prompt appears when registerUser() runs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nothing arrives on iOS, Android works&lt;/td&gt;
&lt;td&gt;APNs key missing, revoked or for the wrong team&lt;/td&gt;
&lt;td&gt;Upload the .p8 key in Firebase → Cloud Messaging. See THIRD_PARTY_AUTH_ERROR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;“No APNS token specified” in the logs&lt;/td&gt;
&lt;td&gt;FCM token requested before iOS gave an APNs token&lt;/td&gt;
&lt;td&gt;Check the Push Notifications capability and test on a real device&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delivered count stays at 0 when the iPhone app is closed&lt;/td&gt;
&lt;td&gt;No Notification Service Extension, or a different App Group&lt;/td&gt;
&lt;td&gt;Add the extension and give it the same App Group as Runner&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Background handler never runs&lt;/td&gt;
&lt;td&gt;Not a top-level function, or no vm:entry-point annotation&lt;/td&gt;
&lt;td&gt;Move it to the top level of a file and add &lt;a class="mentioned-user" href="https://dev.to/pragma"&gt;@pragma&lt;/a&gt;('vm:entry-point')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tap opens the app but not the right screen&lt;/td&gt;
&lt;td&gt;Navigation runs before the navigator exists&lt;/td&gt;
&lt;td&gt;Navigate through a GlobalKey, as in the Step 5 example&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sends fail with UNREGISTERED&lt;/td&gt;
&lt;td&gt;The app was uninstalled or the token was replaced&lt;/td&gt;
&lt;td&gt;Stop sending to that token. See FCM UNREGISTERED&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Getting an error code back from FCM or APNs? The &lt;a href="https://notifysphere.net/blog/topic/push#errors" rel="noopener noreferrer"&gt;FCM and APNs error code table&lt;/a&gt; explains each one and whether to delete the token. Notifications arriving late rather than not at all? See &lt;a href="https://notifysphere.net/blog/real-time-push-notification-sdk" rel="noopener noreferrer"&gt;why push notifications arrive late&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need Firebase for Flutter push notifications?
&lt;/h3&gt;

&lt;p&gt;On Android, yes: push goes through Firebase Cloud Messaging. On iOS, Apple's APNs delivers the notification, but most Flutter apps still use FCM in front of it so one token and one API work for both platforms. That's what firebase_messaging and flutter_notify_sphere do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why don't push notifications show when my Flutter app is open?
&lt;/h3&gt;

&lt;p&gt;Android doesn't display notification messages while the app is in the foreground; the app has to show them itself. flutter_notify_sphere does this with a local notification when showForegroundNotification is true. On iOS the SDK sets the foreground presentation options so the system shows them.&lt;/p&gt;

&lt;h3&gt;
  
  
  When does the notification permission prompt appear?
&lt;/h3&gt;

&lt;p&gt;With flutter_notify_sphere, registerUser() asks for notification permission before it gets the FCM token. Call it at a point where the user understands why you're asking, for example after sign-up, rather than on the very first screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I open a specific screen when the user taps a notification?
&lt;/h3&gt;

&lt;p&gt;Put the screen name or ID in the notification's data, and navigate in onNotificationClick using a GlobalKey. The SDK calls onNotificationClick for taps from the background and for taps that start the app from a terminated state.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know if a push notification was delivered?
&lt;/h3&gt;

&lt;p&gt;FCM only tells you it accepted the message, not that the phone showed it. flutter_notify_sphere reports delivery from the app on Android and from a Notification Service Extension on iOS, and reports taps, so the dashboard shows delivered and clicked counts per campaign.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the Flutter SDK support attribution and deep link campaigns?
&lt;/h3&gt;

&lt;p&gt;Yes, since version 1.2. It reads the TrackerLink click from the Play install referrer on Android, sends it with the user's tags, and records conversions with postEvent. On iOS, installs are matched to recent clicks by IP address or device. Routing to a screen from a deep link is handled by your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://notifysphere.net/docs/flutter" rel="noopener noreferrer"&gt;Flutter SDK reference&lt;/a&gt; lists every option. Using React Native instead? See the &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;React Native push notifications guide&lt;/a&gt;. Comparing push providers? Read &lt;a href="https://notifysphere.net/vs/onesignal-alternative" rel="noopener noreferrer"&gt;notifySphere vs OneSignal&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
    <item>
      <title>Best SDK for Real-Time Push Notification Delivery: What Actually Matters</title>
      <dc:creator>Notify sphere</dc:creator>
      <pubDate>Mon, 12 Oct 2026 09:58:40 +0000</pubDate>
      <link>https://dev.to/notifysphere/best-sdk-for-real-time-push-notification-delivery-what-actually-matters-4g1c</link>
      <guid>https://dev.to/notifysphere/best-sdk-for-real-time-push-notification-delivery-what-actually-matters-4g1c</guid>
      <description>&lt;p&gt;An OTP that arrives after the user gave up, or a “your driver has arrived” alert that shows up five minutes late, is worse than no notification at all. If you're choosing a push SDK because delivery speed matters, here's how delivery actually works and what to compare.&lt;/p&gt;

&lt;h2&gt;
  
  
  How push delivery works
&lt;/h2&gt;

&lt;p&gt;Every push notification takes the same path, whichever SDK you use:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Your server, or your push provider, sends the message with the device's token.&lt;/li&gt;
&lt;li&gt; The platform service delivers it: &lt;strong&gt;Firebase Cloud Messaging (FCM)&lt;/strong&gt; on Android and &lt;strong&gt;Apple Push Notification service (APNs)&lt;/strong&gt; on iOS.&lt;/li&gt;
&lt;li&gt; The operating system wakes your app or shows the notification directly.&lt;/li&gt;
&lt;li&gt; A good SDK then reports back that the message arrived and whether it was tapped.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That means no SDK can deliver faster than FCM or APNs. What an SDK &lt;em&gt;can&lt;/em&gt; do is make sure every message is sent in the way that gets it delivered immediately, and tell you when that didn't happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why push notifications arrive late
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Normal priority on Android.&lt;/strong&gt; FCM holds normal-priority messages while the phone is in Doze mode and delivers them in the next maintenance window. Only high-priority messages wake the device.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hidden high-priority messages.&lt;/strong&gt; Android may deprioritise an app whose high-priority messages don't result in a visible notification. Keep high priority for messages the user will see.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Battery optimisation on some Android phones.&lt;/strong&gt; Several manufacturers stop background apps aggressively, which is common on phones popular in India. Data messages handled by your app suffer most; notification messages shown by the system are more reliable.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Low priority or background pushes on iOS.&lt;/strong&gt; APNs delivers &lt;code&gt;apns-priority: 5&lt;/code&gt; and silent &lt;code&gt;content-available&lt;/code&gt; pushes when it suits the device's power state, and throttles them.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Stale device tokens.&lt;/strong&gt; Tokens change after reinstalls and restores. Sending to an old token fails silently unless your provider removes tokens that FCM or APNs reports as unregistered.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Slow fan-out on the sending side.&lt;/strong&gt; Large campaigns sent one token at a time from a single worker can take minutes to reach the last user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The settings that control delivery speed
&lt;/h2&gt;

&lt;p&gt;For a time-sensitive alert, these are the fields that matter in an FCM HTTP v1 request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DEVICE_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"notification"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Your order is out for delivery"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Arriving in 20 minutes"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"ttl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"600s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"collapse_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"order_1234"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-push-type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"alert"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"apns-collapse-id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"order_1234"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;android.priority: high&lt;/code&gt; and &lt;code&gt;apns-priority: 10&lt;/code&gt; deliver immediately.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;apns-push-type: alert&lt;/code&gt; marks a user-facing notification on iOS.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;ttl&lt;/code&gt; drops the message if it can't be delivered in time, so a stale “driver arriving” alert never shows up an hour later.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;collapse_key&lt;/code&gt; and &lt;code&gt;apns-collapse-id&lt;/code&gt; replace an older update with the newest one instead of stacking them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What to compare when choosing a push SDK
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Why it matters for real-time delivery&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Priority control per message&lt;/td&gt;
&lt;td&gt;OTPs and live updates need high priority; promotions don't&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delivery receipts from the device&lt;/td&gt;
&lt;td&gt;“Sent” isn't “delivered”. You need to see what reached the phone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automatic token refresh and cleanup&lt;/td&gt;
&lt;td&gt;Stale tokens are the quietest cause of lost notifications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Background and killed-app handling&lt;/td&gt;
&lt;td&gt;Notifications must show when the app isn't running&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TTL and collapse support&lt;/td&gt;
&lt;td&gt;Old alerts expire instead of arriving late&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fallback channel&lt;/td&gt;
&lt;td&gt;If a push isn't delivered or opened, a WhatsApp message can still reach the user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SDKs for your stack&lt;/td&gt;
&lt;td&gt;Native setup for React Native and Flutter is where most delivery bugs start&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Comparing providers? See how this plays out in &lt;a href="https://notifysphere.net/vs/onesignal-alternative" rel="noopener noreferrer"&gt;notifySphere vs OneSignal and other OneSignal alternatives&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to test delivery speed yourself
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Install a release build on a real Android phone and a real iPhone, not an emulator.&lt;/li&gt;
&lt;li&gt; Lock both phones and leave them for 30 minutes so Android enters Doze.&lt;/li&gt;
&lt;li&gt; Send a high-priority notification and note the time it appears.&lt;/li&gt;
&lt;li&gt; Repeat with the app force-stopped, and on a phone from a manufacturer known for battery optimisation.&lt;/li&gt;
&lt;li&gt; Compare the send time with the delivery time your provider reports.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real-time push with notifySphere
&lt;/h2&gt;

&lt;p&gt;notifySphere delivers through FCM and APNs, and its &lt;a href="https://notifysphere.net/blog/react-native-push-notifications" rel="noopener noreferrer"&gt;React Native&lt;/a&gt; and &lt;a href="https://notifysphere.net/blog/flutter-push-notifications" rel="noopener noreferrer"&gt;Flutter&lt;/a&gt; SDKs report delivery and taps back to your dashboard, so you see what actually arrived, not just what was sent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;NotifySphere&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-native-notify-sphere&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;applicationUserId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Platform&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OS&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;android&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AndroidPush&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;IOSPush&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_APP_ID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_API_KEY&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Delivery and press events are reported back to your dashboard automatically&lt;/span&gt;
&lt;span class="nx"&gt;NotifySphere&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onNotification&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;press&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// open the screen this notification is about&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a push isn't opened, a journey can follow up on WhatsApp from the same dashboard. Setting up iOS? Start with the &lt;a href="https://notifysphere.net/blog/firebase-ios-push-notifications" rel="noopener noreferrer"&gt;Firebase iOS push guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is the best SDK for real-time push notification delivery?
&lt;/h3&gt;

&lt;p&gt;There's no SDK that is faster than the transport: on Android every push SDK delivers through Firebase Cloud Messaging, and on iOS through Apple Push Notification service. The best SDK is the one that sends with the right priority, keeps device tokens fresh, retries on failure, and reports delivery back to you so you can see what actually arrived.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why are my push notifications delayed on Android?
&lt;/h3&gt;

&lt;p&gt;The usual causes are normal-priority messages held during Doze mode, aggressive battery optimisation on some Android phones that stops apps in the background, and stale device tokens. Send time-sensitive messages with high priority and make sure each one shows a visible notification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why are push notifications delayed on iOS?
&lt;/h3&gt;

&lt;p&gt;Low-priority (apns-priority 5) and background (content-available) pushes are delivered when it suits the device's power state and are throttled. User-facing alerts sent with apns-priority 10 and apns-push-type alert are delivered immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is Firebase Cloud Messaging real-time?
&lt;/h3&gt;

&lt;p&gt;High-priority FCM messages are delivered immediately when the device is online, including waking it from Doze. Normal-priority messages may wait for a maintenance window. FCM is the delivery layer most push SDKs, including notifySphere, use on Android.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can I measure push notification delivery?
&lt;/h3&gt;

&lt;p&gt;A send API returning success only means FCM or APNs accepted the message. To know whether it reached the phone, the SDK on the device has to report a delivery event back. notifySphere's React Native and Flutter SDKs report delivery and taps to your dashboard.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://notifysphere.net/blog/real-time-push-notification-sdk" rel="noopener noreferrer"&gt;notifySphere blog&lt;/a&gt;. notifySphere is push notifications, WhatsApp Business API, deep linking, and in-app support in one SDK — &lt;a href="https://notifysphere.net/pricing" rel="noopener noreferrer"&gt;free up to 1,000 users&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>notifications</category>
    </item>
  </channel>
</rss>
