Troubleshooting for the Cordova Plugin

Common issues and solutions for Airship Cordova plugin setup, initialization, and integration.

This troubleshooting guide will help you resolve common issues with the Airship Cordova plugin.

Common Issues

Below are solutions to common issues you may encounter when integrating the Airship Cordova plugin.

Installation Errors

If you encounter errors during installation:

  • Verify that you’re using a compatible version of Cordova
  • Ensure the plugin is properly installed with cordova plugin add
  • 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 SettingsAPIs & IntegrationsApp Keys
  • Check that takeOff is 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 you’re having trouble with push notifications, check the notification status to see the current state:

Airship.push.getNotificationStatus((status) => {
  console.log('Are notifications allowed:', status.areNotificationsAllowed)
  console.log('Is opted in:', status.isOptedIn)
  console.log('Is user notifications enabled:', status.isUserNotificationsEnabled)
  console.log('Is user opted in:', status.isUserOptedIn)
  console.log('Is pushable:', status.isPushTokenRegistered)
  console.log('Is push privacy feature enabled:', status.isPushPrivacyFeatureEnabled)
})

You can also listen for status changes to debug permission issues:

const subscription = Airship.push.onNotificationStatusChanged((event) => {
  console.log('Notification status changed:', event.status)
  
  if (!event.status.areNotificationsAllowed) {
    console.log('System-level notifications are disabled')
  }
  
  if (!event.status.isUserNotificationsEnabled) {
    console.log('User notifications are disabled in Airship')
  }
  
  if (!event.status.isPushTokenRegistered) {
    console.log('Push token not registered')
  }
})

// Later, to cancel the subscription
subscription.cancel()