Troubleshooting for the React Native Module
Common issues and solutions for Airship React Native module setup, initialization, and integration.
This troubleshooting guide will help you resolve common issues with the Airship React Native module.
Common Issues
Below are solutions to common issues you may encounter when integrating the Airship React Native module.
Installation Errors
If you encounter errors during installation:
- Verify that you’re using a compatible version of React Native
- Ensure all native dependencies are properly linked
- Check that your iOS and Android projects are correctly configured
Initialization Errors
If you encounter errors during SDK initialization:
- Verify your credentials in the Airship dashboard under Settings → APIs & Integrations → App Keys
- Check that
takeOffis called correctly in your app - Ensure both iOS and Android native modules are properly installed
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 permissionisPushPrivacyFeatureEnabled = false: Push privacy feature is disabled in Privacy ManagerisPushTokenRegistered = false: Device hasn’t received a push token yet—check network connectivity and platform configurationisUserOptedIn = 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.
Categories