Troubleshooting for the Android SDK

Common issues and solutions for Airship SDK setup, initialization, and integration.

If you don’t see a channel ID in the logs or encounter errors during initialization, review the following common problems and solutions.

Initialization Errors

The Airship SDK initialization can fail or behave unexpectedly in the following conditions:

  • The SDK is initialized multiple times (e.g., takeOff called in multiple places)
  • The SDK has not been configured properly via Autopilot or an airshipconfig.properties
  • Autopilot configuration or airshipconfig.properties file has invalid or missing credentials
  • Required dependencies are missing from your build.gradle file
  • The SDK is initialized before the application context is available

Credential Validation

The SDK validates that credentials are present and formatted correctly during initialization—it does not verify that the credentials are valid against Airship servers. If the config is properly set up, initialization will succeed even if the credentials themselves are invalid.

Symptoms of invalid credentials:

  • No channel ID appears in the logs
  • Warnings or errors in the logs after initialization
  • Channel is not created in the Airship dashboard
  • Push notifications are not received

To verify your credentials:

  • Check that your credentials in the Airship dashboard (under SettingsAPIs & IntegrationsApp Keys) match what you’ve configured in your app
  • Ensure you’re using the correct credentials for your build configuration (development vs production)
  • Verify both production and development credentials are correctly set in Autopilot or airshipconfig.properties
  • Check that credentials are not empty strings or contain extra whitespace

Common Issues

SDK initialized multiple times

  • Ensure the SDK is only initialized once per app launch
  • Verify that you’re not calling takeOff in multiple places (e.g., in both an Autopilot and Application.onCreate())

Missing or invalid credentials

  • Verify your credentials in the Airship dashboard under SettingsAPIs & IntegrationsApp Keys
  • Check that you’re using the correct credentials for your build configuration (development vs production)
  • Ensure both productionAppKey/productionAppSecret and developmentAppKey/developmentAppSecret are set in your Autopilot or airshipconfig.properties
  • Verify credentials match the expected format and character set
  • Check that credentials are not empty strings or contain extra whitespace

airshipconfig.properties not found or invalid

  • Verify the file exists in your app’s src/main/assets/ directory
  • Check that the file name is exactly airshipconfig.properties
  • Ensure all required keys (productionAppKey, productionAppSecret, developmentAppKey, developmentAppSecret) are present
  • Verify the file format is valid (standard Java properties format)
  • Check that the file is included in your build output

FCM configuration issues

  • Verify your google-services.json file is properly configured
  • Ensure the FCM dependency is included in your build.gradle file
  • Check that the Google Services plugin is applied in your build.gradle file
  • Verify your Firebase project is properly set up in the Firebase Console

Checking Push Notification Status

If push notifications aren’t working as expected, you can check the notification status to diagnose the issue. The SDK provides detailed information about the current state of push notifications.

Get Current Notification Status

Check notification status

val status = Airship.push.pushNotificationStatus

Log.d("Airship", "User notifications enabled: ${status.isUserNotificationsEnabled}")
Log.d("Airship", "Notifications allowed: ${status.areNotificationsAllowed}")
Log.d("Airship", "Privacy feature enabled: ${status.isPushPrivacyFeatureEnabled}")
Log.d("Airship", "Push token registered: ${status.isPushTokenRegistered}")
Log.d("Airship", "User opted in: ${status.isUserOptedIn}")
Log.d("Airship", "Fully opted in: ${status.isOptIn}")
PushNotificationStatus status = Airship.getPush().getPushNotificationStatus();

Log.d("Airship", "User notifications enabled: " + status.isUserNotificationsEnabled());
Log.d("Airship", "Notifications allowed: " + status.getAreNotificationsAllowed());
Log.d("Airship", "Privacy feature enabled: " + status.isPushPrivacyFeatureEnabled());
Log.d("Airship", "Push token registered: " + status.isPushTokenRegistered());
Log.d("Airship", "User opted in: " + status.isUserOptedIn());
Log.d("Airship", "Fully opted in: " + status.isOptIn());

Listen for Status Changes

To monitor notification status changes in real-time:

Monitor notification status

scope.launch {
    Airship.push.pushNotificationStatusFlow.collect { status ->
        Log.d("Airship", "Notification status changed:")
        Log.d("Airship", "User opted in: ${status.isUserOptedIn}")
        Log.d("Airship", "Fully opted in: ${status.isOptIn}")
    }    
}
Airship.getPush().addNotificationStatusListener(status -> {
    Log.d("Airship", "Notification status changed:");
    Log.d("Airship", "User opted in: " + status.isUserOptedIn());
    Log.d("Airship", "Fully opted in: " + status.isOptIn());
});

Understanding Notification Status Fields

The NotificationStatus class provides detailed information about why push might not be working:

FieldDescription
isUserNotificationsEnabledWhether pushManager.userNotificationsEnabled is set to true
areNotificationsAllowedWhether the user has granted notification permissions
isPushPrivacyFeatureEnabledWhether the push privacy feature is enabled in PrivacyManager
isPushTokenRegisteredWhether a push token has been successfully registered with FCM
isUserOptedIntrue if user notifications are enabled, privacy feature is enabled, and notifications are allowed
isOptIntrue if isUserOptedIn is true AND a push token is registered

Common Status Scenarios

Status: isUserNotificationsEnabled = false

  • Cause: pushManager.userNotificationsEnabled has not been set to true
  • Solution: Enable user notifications in your app code

Status: areNotificationsAllowed = false

  • Cause: User denied notification permissions or permissions not yet requested (Android 13+)
  • Solution: Request notification permissions or guide user to system settings

Status: isPushPrivacyFeatureEnabled = false

  • Cause: Push privacy feature is disabled in Privacy Manager
  • Solution: Enable the push privacy feature: UAirship.shared().privacyManager.setEnabledFeatures(PrivacyManager.Feature.PUSH)

Status: isPushTokenRegistered = false

  • Cause: Device hasn’t received a push token from FCM yet
  • Solution: Check network connectivity, FCM configuration, and device/emulator limitations

Status: isUserOptedIn = true but isOptedIn = false

  • Cause: Push token registration is pending or failed
  • Solution: Check Logcat for FCM registration errors, verify network connectivity, and ensure proper FCM setup