Troubleshooting Push Notifications Using Plivo Console Logs

To deliver incoming call notifications, the iOS SDK uses the Apple Push Notification service (APNs) and the Android SDK uses Google Firebase Cloud Messaging (FCM). To make debugging issues easier, we present errors related to push notifications in the call debug logs available on the Plivo console.

Plivo console

Common Issues

Here are some common issues that can arise when using push notifications for incoming mobile SDK calls.

  1. Some notifications are received, but not all

    Are you sending multiple push notifications simultaneously in a sandbox environment? The sandbox environment is meant for testing purposes and should not be used to trigger multiple push notifications simultaneously. APNs maintains a QoS (quality of service) queue for each device with a push app. The size of the queue is 1. The sandbox environment is used only for testing purposes.

  2. Problem connecting to push notification service

    1. A firewall might be blocking traffic from Firebase/APNs to the mobile device. Make sure the firewall is not blocking traffic on these ports:
      1. TCP port 5223 to communicate with APNs
      2. TCP port 443 is required for device activation from APNs
      3. TCP port 5228, 5229, 5230 to communicate with Firebase
    2. For iOS, the private key and certificate uploaded on the Plivo console might be wrong. Each App ID has a unique CSR and private key combination. Read our detailed guide to setting up push notifications for iOS.
    3. For Android, the FCM API key might be incorrect. Read our detailed guide to setting up push notifications for Android.

  3. No longer receiving push notifications

    It’s likely that device token has changed. This can happen when an app is uninstalled or reinstalled. Make sure that you’re using the correct device token during Plivo endpoint registration. (iOS/Android)

Push Notifications Failures

Plivo shares information regarding push notification failures in its call debug logs. Here’s a list of error messages related to push notification failures that you may come across in Plivo console logs.

  1. Error: InvalidCredentials, Reason: Using a wrong or expired iOS/Android Push notification certificate.

    Possible cause:
    Using a wrong or expired iOS/Android certificate on the Plivo console

    Description:
    An certificate cannot be used for sending push notifications after its expiration date has passed. iOS certificates can be inactive by revoking and invalidating them from Apple’s Developer Center. Android FCM API keys can be deleted from the Firebase console.

    Recommended solution:
    For iOS, make sure that the correct certificate and private key are uploaded on the Plivo console. Sign in to Apple’s Developer Center and ensure that provisioning profile is active and respective certificates have not been expired, revoked, or invalidated. For Android, make sure the correct FCM API key is uploaded on the Plivo console and is active on Firebase console.

  2. Error: BadDeviceToken, Reason: Using Push notification certificate for the wrong environment (production/sandbox)

    Possible cause:
    Using an iOS certificate for the wrong environment

    Description:
    Apple issues different SSL certificates for development and production purposes. If there’s a mismatch between the certificate type (production/sandbox) specified on the Plivo console and your app’s actual provisioning profile, your device will not be able to receive push notifications.

    Recommended solution:
    Make sure the certificate type selected on Plivo console matches the iOS provisioning profile of your app and certificate. Register your Plivo endpoint again to make sure that you’re using a valid device token after correcting the certificate.

  3. Error: DeviceTokenNotForTopic, Reason: Push notification certificate and Device App provisioned with different Apple App ID

    Possible cause:
    Push notification certificate and device app are provisioned with different Apple App ID.

    Description:
    This error is returned from APNs when the presented push notifications token attributes do not match the topic specified at the time of sending. The device token was issued to an app with a given Apple App ID but the push notification certificate is configured for another Apple App ID.

    Recommended solution:
    Ensure that the Apple App ID of the provisioning profile with which the application is deployed to a device matches the Apple App ID for which the push notification SSL certificate is configured. Register your Plivo endpoint again to make sure that you’re using a valid device token after you correct the certificate.

  4. Error: InvalidPlatformToken, Reason: Push notification certificate is invalid.

    Possible cause:

    1. Using an iOS certificate for the wrong environment (production/sandbox)
    2. Push notification certificate and device app are provisioned with different Apple App IDs.
    3. Device token is expired. GCM and APNs update their tokens from time to time.

    Recommended solution:
    Pinpoint the issue from other console log errors, such as DeviceTokenNotForTopic or BadDeviceToken, if present, or reregister Plivo endpoint.

  5. Push notification certificate is missing. Upload iOS push notification certificate on Plivo console. or Push notification certificate is missing. Upload FCM Server key on Plivo console.

    Possible cause:
    Push notification certificate is not present on Plivo console.

    Description:
    To deliver incoming call notifications, Plivo uses Apple Push Notification service (APNs) for iOS and Google Firebase Cloud Messaging (FCM) for Android.

    Recommended solution:
    Read our detailed guide to setting up push notifications for iOS and Android.