Hi,
Currently facing the same issue as described here http://support.backendless.com/t/ios-is-receiving-duplicate-notifications-from-a-single-console-push
Sending notifications form the Backendless console results in recipients getting multiple notifications on their device. This behaviour is not observed when sending notifications through iOS app, only when sent from Backendless console
Hi Mitchell,
Please check the message IDs: the one sent from console (see the screenshot) and the IDs of two messages you receive on the device. Need to know whether they all are the same.
hi Sergey,
How can I check the message IDs of the notifications I receive on the device?
Search for “Receiving messages in Backendless internal format” in the messaging doc for your language, here is an example for Android: http://backendless.com/docs/android/doc.html#pubsub_message_listener
This is happening for push notifications, not for pub/sub messaging. It is also not consistent, some people will receive a single message, some 2, some 5, some 10, all of the same thing when only 1 was originally sent
From our experience this is usually most probably the problem in the handler of the app. How does the code for it look like in your case?
Oh, and another problem might be in the number of device registrations from the same device. Are there many of them in your app? Probably you could identify which of them might be linked to the same physical device?
For registering a device it is like this,
func registerForPushNotifications() {
if Reachability.isConnectedToNetwork() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
print("Permission granted: \(granted)")
guard granted else { return }
self.getNotificationSettings()
}
}else {
noNetworkConnection()
}
}
func getNotificationSettings() {
UNUserNotificationCenter.current().getNotificationSettings { (settings) in
print("Notification settings: \(settings)")
guard settings.authorizationStatus == .authorized else { return }
DispatchQueue.main.async(execute: {
UIApplication.shared.registerForRemoteNotifications()
})
if settings.authorizationStatus == .authorized {
self.notificationsEnabled = true
}
let deviceRegistration: DeviceRegistration = self.backendless.messaging.currentDevice()
self.deviceID = deviceRegistration.deviceId
}
}
then
func getNotificationSettings() {
UNUserNotificationCenter.current().getNotificationSettings { (settings) in
print("Notification settings: \(settings)")
guard settings.authorizationStatus == .authorized else { return }
DispatchQueue.main.async(execute: {
UIApplication.shared.registerForRemoteNotifications()
})
if settings.authorizationStatus == .authorized {
self.notificationsEnabled = true
}
let deviceRegistration: DeviceRegistration = self.backendless.messaging.currentDevice()
self.deviceID = deviceRegistration.deviceId
}
}
I downloaded the list of registered devices from Backendless and opened in Excel. There are no duplicate device IDs or device tokens
Also, for your reference, the iOS app I created to send push notifications to users of my main app uses the API like this:
let publishOptions = PublishOptions()
publishOptions.assignHeaders(["ios-alert-title":"Announcement",
"ios-sound":"default"])
let deliveryOptions = DeliveryOptions()
deliveryOptions.pushBroadcast(FOR_IOS.rawValue)
backendless?.messaging.publish(
"default",
message: message,
publishOptions:publishOptions,
deliveryOptions:deliveryOptions,
response: {
(status: MessageStatus?) -> Void in
print("Status: \(status)")
},
error: {
(fault: Fault?) -> Void in
print("Server reported an error: \(fault)")
})
}
This results in users receiving a single push notification per device, so it cannot be to do with the way the app receives and handles the push notifications.
What I did notice, the number of notifications sent (as reported by backendless -> manage -> analytics -> messages) do not match the number of entries in DeviceRegistration
Hi Mitchel
I’ve created an internal ticket BKNDLSS-17423 for investigation the issue, and we will notify you about any result here
Thanks, Vlad
Good on ya Vlad, cheers mate