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.,
takeOffcalled in multiple places) - The SDK has not been configured properly via Autopilot or an
airshipconfig.properties - Autopilot configuration or
airshipconfig.propertiesfile has invalid or missing credentials - Required dependencies are missing from your
build.gradlefile - 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 Settings → APIs & Integrations → App 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
Autopilotorairshipconfig.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
takeOffin multiple places (e.g., in both anAutopilotandApplication.onCreate())
Missing or invalid credentials
- Verify your credentials in the Airship dashboard under Settings → APIs & Integrations → App Keys
- Check that you’re using the correct credentials for your build configuration (development vs production)
- Ensure both
productionAppKey/productionAppSecretanddevelopmentAppKey/developmentAppSecretare set in yourAutopilotorairshipconfig.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.jsonfile is properly configured - Ensure the FCM dependency is included in your
build.gradlefile - Check that the Google Services plugin is applied in your
build.gradlefile - 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:
| Field | Description |
|---|---|
isUserNotificationsEnabled | Whether pushManager.userNotificationsEnabled is set to true |
areNotificationsAllowed | Whether the user has granted notification permissions |
isPushPrivacyFeatureEnabled | Whether the push privacy feature is enabled in PrivacyManager |
isPushTokenRegistered | Whether a push token has been successfully registered with FCM |
isUserOptedIn | true if user notifications are enabled, privacy feature is enabled, and notifications are allowed |
isOptIn | true if isUserOptedIn is true AND a push token is registered |
Common Status Scenarios
Status: isUserNotificationsEnabled = false
- Cause:
pushManager.userNotificationsEnabledhas not been set totrue - 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
Categories