Troubleshooting Push Notifications
Check push notification status and fix common issues.
If push notifications aren’t working as expected, you can check the notification status to diagnose the issue.
Push Notifications Not Working
If push notifications are not being received:
- Verify that push notifications are enabled for both iOS and Android.
- Check that APNs (iOS) and FCM (Android) are properly configured.
- Ensure the app has notification permissions.
Checking Push Notification Status
If push notifications aren’t working as expected, you can check the notification status to diagnose the issue:
const status = await Airship.push.getNotificationStatus();
console.log('User notifications enabled:', await Airship.push.isUserNotificationsEnabled());
console.log('Notifications allowed:', status.areNotificationsAllowed);
console.log('Push token registered:', status.isPushTokenRegistered);
console.log('Privacy feature enabled:', status.isPushPrivacyFeatureEnabled);
console.log('User opted in:', status.isUserOptedIn);
console.log('Fully opted in:', status.isOptedIn);You can also listen for status changes:
Airship.addListener(EventType.PushNotificationStatusChangedStatus, (event) => {
console.log('Notification status changed:', event.status);
console.log('Is opted in:', event.status.isOptedIn);
});Common Status Scenarios
isUserOptedIn = false: Check ifuserNotificationsEnabledis set totrueand if the user granted permission.isPushPrivacyFeatureEnabled = false: Push privacy feature is disabled in Privacy Manager.isPushTokenRegistered = false: Device hasn’t received a push token yet. Check network connectivity and platform configuration.isUserOptedIn = truebutisOptedIn = false: Push token registration is pending or failed. Check console logs for errors.
Expo: Push Notifications Not Received
If you don’t receive Airship pushes in your Expo app, make sure you didn’t previously install expo-notifications or another push provider by mistake. There can only be one service in each app that receives FCM messages, so it might create conflicts with Airship.
If you do want to have another push provider alongside Airship, you will need to create your own FirebaseMessagingService to forward onNewToken and onMessageReceived calls to the Airship SDK. Follow the steps for Extending the FirebaseMessagingService in the Android SDK Setup documentation.
If you’re running Firebase alongside Airship, see Extending the FirebaseMessagingService for Android configuration.