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.
Here are some common issues that can arise when using push notifications for incoming mobile SDK calls.
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.
Problem connecting to push notification service
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)
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.
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.
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.
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.
Error: InvalidPlatformToken, Reason: Push notification certificate is invalid.
Possible cause:
Recommended solution:
Pinpoint the issue from other console log errors, such as DeviceTokenNotForTopic or BadDeviceToken, if present, or reregister Plivo endpoint.
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.