See platform specific errors
If you aren't receiving expected Push Notifications on your device, this can be due various reasons. You'll need to figure out if it's an issue on Ably's side or some issue with your device's registration with FCM/APNS.
The following steps can help you get a better idea of what may be happening:
1. Find your device's identifier (deviceId, clientId, etc)
In the Ably dashboard, go to the Notifications tab and use the device inspector to inspect that device ID.
If the state is FAILED an error should also be displayed.
The most common error is registration expired where the user uninstalled the app or disabled notifications.
If the device is ACTIVE then you can use the push inspector to test notifications to a device:
2. Use Ably's REST API to publish a push notification directly to your device using the 'deviceId' (or any other supported identifier) to see if this part of the message flow is working
3. You can also look at the stats within the Notifications section on your Ably app dashboard to understand if the push notifications are successfully was delivered at all from Ably.
4. You can look for any push related errors via the Ably dev console to inspect the logs at the time or you can subscribe to the [meta]log:push channel instead.
From any errors there you should see an FCM or APNS reason why the notification failed. If no logs are raised it means the notification succeeded.
If this is working normally, then the issue is most likely with your native notification provider i.e FCM/APNS.
Specific errors
APNs
Runner.entitlements
) matches the environment set in Ably dashboards push notification tab.When running a debug application, the sandbox / development APNs server is used. Make sure to use an application with
Use APNS sandbox environment?
enabled in the Ably dashboard (push notification tab). Changing the aps-environment
value in the .entitlements
file to production
does not make the debug application use the production APNs server.DeviceTokenNotForTopic - In this case the error is returned from APNS when the bundle Id of a token or certificate uploaded to Ably does not match the bundle id in you Xcode project settings
FCM
FcmTransport not configured - In this case the json file uploaded is not in the expected format of a service account key file. Please check the steps required on the configuring android documentation.
403 Forbidden - In this case it could mean that the firebase cloud messaging API is not enabled in your FCM project. Check that the Firebase cloud messaging API (V1) is enabled under the FCM projects cloud messaging tab.
It could also mean the service account used does not have the correct permissions e.g Permission 'cloudmessaging.messages.create' denied on resource
404 NOT_FOUND (UNREGISTERED) - In this case the device has been unregistered for push with FCM. This can happen if the app is uninstalled on the device and therefore deactivate has never been called and the registration remains on Ably. You can check a list of registered devices via the REST API or push admin from an Ably SDK
404 Unable to get device; not found - In this case the device is most probably in a failed state and can be from sending a push to a device that is already unregistered (as above). You can check the status of the specific device id via the push admin API
DeprecatedApi - In this case this is related to the deprecation of the legacy google FCM API. You will need to create a service account key to upload the JSON to the ably dashboard so the push notifications are sent to the HTTP v1 API