1--- 2title: Push notifications troubleshooting and FAQ 3sidebar_title: Troubleshooting and FAQ 4description: A collection of common questions about Expo's push notification service. 5--- 6 7import { Collapsible } from '~/ui/components/Collapsible'; 8 9A collection of common issues and FAQs when setting up push notifications with the `expo-notifications` library and Expo's push notification service. 10 11## Expo's push notification service 12 13### Cost of the push notification service 14 15There is no cost associated with sending notifications through Expo's classic push notification service. 16 17### Limit of sending notifications 18 19There is a limit of 600 notifications per second per project that can be sent. If you exceed this rate, subsequent requests will fail until the rate falls below 600 per second again. 20 21For best results, we recommend you add throttling (which is handled automatically in the [`expo-server-sdk-node`](https://github.com/expo/expo-server-sdk-node)) and retry logic to your server. 22 23### Using Expo's push notification service is not mandatory 24 25You can use any push notification service for Expo projects. The [`getDevicePushTokenAsync` method from `expo-notifications`](/versions/latest/sdk/notifications/#getdevicepushtokenasync-devicepushtoken) allows you to get the native device push token, which you can then use with other services, or even [send your notifications directly through FCM and APNs](/push-notifications/sending-notifications-custom). 26 27### Connections to notification service are encrypted 28 29Expo's connections to Apple and Google are encrypted and use HTTPS. 30 31### Contents of the notification are not stored 32 33Expo doesn't store the contents of push notifications any longer than it takes to deliver the notifications to the push notification services operated by Apple, Google, and so on. Notifications are stored only in memory and in message queues and not stored in databases. 34 35### Contents of the notifications may be seen by Expo staff 36 37If the Expo team is actively debugging the push notifications service, we may see notification contents (for example, at a breakpoint) but Expo cannot see push notification contents otherwise. 38 39### Delivery guarantees 40 41Expo makes the best effort to deliver notifications to the push notification services operated by Google and Apple. Expo's infrastructure is designed for at-least-once delivery to the underlying push notification services. In some cases, a notification may be delivered to Google or Apple more than once or not at all, although these cases are rare. 42 43After a notification has been handed off to an underlying push notification service, Expo creates a "push receipt" that records whether the handoff was successful. A push receipt denotes whether the underlying push notification service received the notification. 44 45Finally, the push notification services from Google, Apple, and so on follow their policies to deliver the notification to the device. 46 47## Push notifications 48 49### Notifications aren't working 50 51Push notifications have a lot of moving parts, so this can be due to a wide variety of reasons. To narrow things down, check the [push ticket](/push-notifications/sending-notifications/#push-tickets) and [push receipt](/push-notifications/sending-notifications/#push-receipts) for error messages. 52 53You can also narrow things even further by testing [local notifications](/versions/latest/sdk/notifications/#schedulenotificationasyncnotificationrequest-notificationrequestinput-promisestring) in your app. This will ensure all of your client-side logic is correct, and narrow things down to the server side or app credentials. 54 55<Collapsible summary="See here for some quick terminal commands you can use to get the push receipt"> 56 571. Send a notification: 58 59```shell 60curl -H "Content-Type: application/json" -X POST "https://exp.host/--/api/v2/push/send" -d '{ 61 "to": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]", 62 "title":"hello", 63 "body": "world" 64}' 65``` 66 672. Use the resulting ticket `id` to request the push receipt: 68 69```shell 70curl -H "Content-Type: application/json" -X POST "https://exp.host/--/api/v2/push/getReceipts" -d '{ 71 "ids": [ 72 "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" 73 ] 74}' 75``` 76 77</Collapsible> 78 79### When and why does the `ExpoPushToken` change 80 81The `ExpoPushToken` will remain the same across app upgrades. On iOS, it will also remain the same even after uninstalling the app and reinstalling it. On Android, this results in the push token changing. 82 83It will also change if you change your [`applicationId`](/versions/latest/sdk/application.mdx#applicationapplicationid) or `experienceId` (usually `@expoUsername/projectSlug`). 84 85The `ExpoPushToken` will never expire. However, if one of your users uninstalls the app, you'll receive a `DeviceNotRegistered` error back from Expo's servers. This means you should stop sending notifications to this app. 86 87### Notifications work in development, but not after building the app 88 89This indicates that you have either misconfigured your credentials or didn't configure them at all in your production app. Expo Go uses Expo's credentials, which allows working on notifications in development. 90 91When you build your app for the app stores, you need to generate and use your own credentials. On Android, follow [this guide](/push-notifications/push-notifications-setup/#android). On iOS, this is handled by your [push key](/app-signing/app-credentials/#push-notification-keys) (revoking the push key associated with your app will result in your notifications failing to be delivered. To fix that, add a new push key with `eas credentials`). 92 93For more information, see [app signing](/app-signing/app-credentials). 94 95### Notifications occasionally stop coming through on Android 96 97This is likely due to the `priority` level of the notifications you're sending. You can learn more about [Android priority](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json). [Expo accepts four priorities](/push-notifications/sending-notifications/#message-request-format): 98 99- `default`: manually mapped to the default priority documented by Apple and Google 100- `high`: mapped to the high priority level documented by Apple and Google 101- `normal`: mapped to the normal priority level documented by Apple and Google 102- (priority omitted): treated exactly as if `default` were specified 103 104And setting the priority to `high` gives your notification the greatest likelihood that the Android will display the notification. 105 106### Handle expired push notification credentials 107 108When your push notification credentials have expired, run `eas credentials`, choose iOS and a build profile, then remove your push notification key and generate a new one. 109 110### Error message when sending a notification 111 112Check the `details` property of the returned push ticket or receipt for more information. [Read this](/push-notifications/sending-notifications/#errors) for common error code responses and their associated solutions. 113 114### Fetching a push token takes a long time on iOS 115 116`getDevicePushTokenAsync` and `getExpoPushTokenAsync` can sometimes take a long time to resolve on iOS. This is outside of `expo-notifications`'s control, as stated in Apple's [Troubleshooting Push Notifications](https://developer.apple.com/library/archive/technotes/tn2265/_index.html) technical note: 117 118> This is not necessarily an error condition. The system may not have Internet connectivity at all because it is out of range of any cell towers or Wi-Fi access points, or it may be in airplane mode. Instead of treating this as an error, your app should continue normally, disabling only that functionality that relies on push notifications. 119 120Here are some ways our community members have resolved this issue: 121 122<Collapsible summary={<span>Read the Apple's <a href="https://developer.apple.com/library/archive/technotes/tn2265/_index.html">Technical Note on troubleshooting push notifications</a></span>}> 123 124Read Apple's [Technical Note on troubleshooting push notifications](https://developer.apple.com/library/archive/technotes/tn2265/_index.html)! This is the single most reliable source of information on this problem. To help you grasp what they're suggesting: 125 126- Make sure the device has a reliable connection to the Internet (try turning off Wi-Fi or switching to another network, and disabling the firewall block on port 5223, as suggested in [this SO answer](https://stackoverflow.com/a/34332047/1123156)). 127- **Bare React Native apps** must [manually enable the **Push Notifications** capability](/build-reference/ios-capabilities#manual-setup). If you have trouble setting this up, refer to [this Stack Overflow answer](https://stackoverflow.com/a/10791240/1123156). You may also want to try to debug this even further by logging persistent connection debug information as outlined by [this Stack Overflow answer](https://stackoverflow.com/a/8036052/1123156). 128 129</Collapsible> 130 131<Collapsible summary="Try again in a little while"> 132 133- APNS servers near the device may be down as indicated by [this forum thread](https://developer.apple.com/forums/thread/52224). Take a walk and try again later! 134- Try again in a few days as suggested by [this GitHub comment](https://github.com/expo/expo/issues/10369#issuecomment-717872956). 135 136</Collapsible> 137 138<Collapsible summary="Disable network sharing on your device"> 139 140You may need to disable network sharing as this may impact the registration as suggested by [this Stack Overflow answer](https://stackoverflow.com/a/59156989/1123156). 141 142</Collapsible> 143 144<Collapsible summary="Restart your device"> 145 146If you just changed the APNS servers where the app should be registering (by installing a TestFlight build over an Xcode build on the same device) you may need to restart your device as suggested by [this Stack Overflow answer](https://stackoverflow.com/a/59864028/1123156). 147 148</Collapsible> 149 150<Collapsible summary="Setup your device with a SIM card"> 151 152If the device you're experiencing this on hasn't been setup with a SIM card it looks like configuring it may help mitigate this bug as suggested by [this Stack Overflow answer](https://stackoverflow.com/a/19432504/1123156). 153 154</Collapsible> 155 156## Miscellaneous 157 158### Sending notifications directly through FCM and APNs 159 160If you are not using [Expo's push notification service](/push-notifications/sending-notifications) and instead, would like to communicate with Google and Apple directly, see [Send notifications with FCM and APNs](/push-notifications/sending-notifications-custom), paying **special attention to the payload formats**, since providing different formats can result in unexpected behavior on both platforms. 161 162### Notification icon on Android is a grey or white square 163 164This indicates an issue with the image asset you're providing. The image should be all white with a transparent background (this is required and enforced by Google, not Expo). For more information, see [this article](https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/). 165 166### Play a custom sound when I send a notification 167 168The Expo push notification service currently doesn't support custom sounds. You will need to use FCM and APNs directly with the native device tokens received from `expo-notifications` in standalone apps. 169 170### Migrate from Expo's `LegacyNotifications` library 171 172For more information on how to migrate from Expo's `LegacyNotifications` library to use `expo-notifications`, see [the migration guide](https://expo.fyi/legacy-notifications-to-expo-notifications). 173