Closed mathayan321 closed 1 year ago
What is the issues Completed ?
@mathayan321 I have re-opened the issue.
@vdovbnya-qb Please check the code and write an answer.
@mathayan321 You are creating a list and trying to iterate over it, but the list is empty. You don't add it opponentId
val userIds1 = StringifyArrayList()
for (user in userIds1!!) {
userIds1.add(opponentId)
}
Try to add opponentId to the list without a loop
val userIds1 = StringifyArrayList()
userIds1.add(opponentId)
val event = QBEvent()
event.userIds = userIds1
event.environment = QBEnvironment.DEVELOPMENT
event.notificationType = QBNotificationType.PUSH
event.pushType = QBPushType.GCM
val customData = HashMap<String, Any>()
customData["data.message"] = text.toString()
customData["data.title"] = currentUser.fullName
customData["data.notification_id"] = 11
event.setMessage(customData)
QBPushNotifications.createEvent(event).performAsync(object : QBEntityCallback<QBEvent> {
override fun onSuccess(qbEvent: QBEvent?, bundle: Bundle?) {
Log.e("QB_notification","send")
Log.e("CustomerData", Gson().toJson(qbEvent))
}
override fun onError(e: QBResponseException?) {
Log.e("PN_error", e?.message.toString())
}
})
val userIds1 = StringifyArrayList()