QuickBlox / quickblox-android-sdk

QuickBlox Android SDK includes code snippets with main use cases and framework JAR library.
BSD 3-Clause "New" or "Revised" License
417 stars 697 forks source link

No recipients. At least one user should be subscribed for 'apns' #655

Closed tempersitu closed 3 years ago

tempersitu commented 5 years ago

I'm using Android SDK 3.8.1. After send the text message, I send notification as below code(kotlin):


`private fun sendIOSNotification(dialog: QBChatDialog, message: String) { try{ val userIds = StringifyArrayList() dialog.occupants.filter { it.toString() != qbUser?.id?.toString() }.forEach { userIds.add(it) }

        val event: QBEvent = QBEvent()
        event.userIds = userIds
        event.environment = if (BuildConfig.FLAVOR == "prod") {
            QBEnvironment.PRODUCTION
        } else {
            QBEnvironment.DEVELOPMENT
        }
        event.notificationType = QBNotificationType.PUSH
        event.pushType = QBPushType.APNS

        val data = HashMap<String, Any>()
        val apsData = HashMap<String, Any>()
        apsData.put("alert", "${MemberManager.user?.name}: $message")
        apsData.put("sound", "default")
        data.put("aps", apsData)
        data.put("dialog_id", dialog.dialogId)
        data.put("type", "chat_dialog")

        event.setMessage(data)

        QBPushNotifications.createEvent(event).performAsync(object : QBEntityCallback<QBEvent> {
            override fun onError(p0: QBResponseException?) {
                log("send message ios notification fail")
                log("${p0?.message}")
            }

            override fun onSuccess(p0: QBEvent?, p1: Bundle?) {
                log("send message ios notification success")
            }
        })
    }catch (e:Exception){
        e.printStackTrace()
    }
}

private fun sendAndroidNotification(dialog: QBChatDialog, message: String) {
    try{
        val userIds = StringifyArrayList<Int>()
        dialog.occupants.filter { it.toString() != qbUser?.id?.toString() }.forEach {
            userIds.add(it)
        }

        val event: QBEvent = QBEvent()
        event.userIds = userIds
        event.environment = if (BuildConfig.FLAVOR == "prod") {
            QBEnvironment.PRODUCTION
        } else {
            QBEnvironment.DEVELOPMENT
        }
        event.notificationType = QBNotificationType.PUSH
        event.pushType = QBPushType.GCM

        val map: HashMap<String, Any> = HashMap()
        map.put("data.message", "${MemberManager.user?.name}: $message")
        map.put("data.dialog_id", dialog.dialogId)
        map.put("data.type", "chat_dialog")

        event.setMessage(map)

        QBPushNotifications.createEvent(event).performAsync(object : QBEntityCallback<QBEvent> {
            override fun onError(p0: QBResponseException?) {
                log("send message android notification fail")
                log("${p0?.message}")
            }

            override fun onSuccess(p0: QBEvent?, p1: Bundle?) {
                log("send message android notification success")
            }
        })
    }catch (e:Exception){
        e.printStackTrace()
    }
}`

Here's the problem, Android->Android is OK iOS -> iOS is OK iOS ->Android is OK Android -> iOS can't receive

Sometime the logs show success or {"errors":{"base":["No recipients. At least one user should be subscribed for 'apns' (through SDK or REST API)"]}}, however, the iOS can't receive the notification even show success. tim 20181224173124 Panel shows the notifications were sent, may anyone help me and what can I do? Many thanks

ghost commented 3 years ago

Hello QuickBlox customer,

This is Nikolay from QuickBlox support.

The issue was closed as it was outdated.

Please check the relevant sections of our documentation here: https://docs.quickblox.com/docs/ios-push-notifications https://docs.quickblox.com/docs/android-push-notifications

Also, please update the SDKs to the latest versions: https://github.com/QuickBlox/quickblox-android-sdk-releases/releases/tag/3.9.11 https://github.com/QuickBlox/quickblox-ios-sdk/releases/tag/2.17.10

Additionally, please check our new samples: https://docs.quickblox.com/docs/code-samples#chat-samples

If it is still relevant after reviewing the updated information, feel free to open a new issue.

Have a nice day.

Krishansharma commented 2 years ago

Hello QuickBlox customer,

This is Nikolay from QuickBlox support.

The issue was closed as it was outdated.

Please check the relevant sections of our documentation here: https://docs.quickblox.com/docs/ios-push-notifications https://docs.quickblox.com/docs/android-push-notifications

Also, please update the SDKs to the latest versions: https://github.com/QuickBlox/quickblox-android-sdk-releases/releases/tag/3.9.11 https://github.com/QuickBlox/quickblox-ios-sdk/releases/tag/2.17.10

Additionally, please check our new samples: https://docs.quickblox.com/docs/code-samples#chat-samples

If it is still relevant after reviewing the updated information, feel free to open a new issue.

Have a nice day.

Hi Nikolay, I am also getting error when I sent push notification from android to an iOS device, error message is below- '{"errors":{"base":["No recipients. At least one user should be subscribed for 'fcm' (through SDK or REST API)"]}}'

i read your documentation also, but have not seen anything for resolving issue. Please help

ghost commented 2 years ago

hello Please check if you send push notifications from Android to iOS to the APNS channel and if iOS devices are subscribed to the channel.

Also, please check our guides: https://quickblox.kayako.com/article/357-how-do-i-configure-chat-and-video-calling-push-notifications-and-offline-messaging

Krishansharma commented 2 years ago

Hi Nikolay, Channel is creating successfully, but not sending android to iOS push notifications, error is coming the same:- '{"errors":{"base":["No recipients. At least one user should be subscribed for 'fcm' (through SDK or REST API)"]}}'

I am still working from last week, but not resolve

ghost commented 2 years ago

To investigate the issue further, we need the following points:

  1. Please update the SDKs to the latest versions: https://github.com/QuickBlox/quickblox-android-sdk-releases/releases/tag/3.9.18 https://github.com/QuickBlox/quickblox-ios-sdk/releases/tag/2.17.11
  2. Is this issue intermittent or permanent?
  3. What are the steps to reproduce on our side?
  4. Did you get this issue in your code or on samples?
  5. Please try reproducing the issue on our samples https://docs.quickblox.com/docs/code-samples
  6. Provide push notification logs: https://help.quickblox.com/article/407-how-can-i-check-push-notification-logs
  7. Please provide us with full REST + XMPP logs as an attachment to this ticket in .txt format. There should be logs from application start till request and "wrong" response (error). You can find out how to gather logs here: Gathering logs guides - QuickBlox Help Center