Closed darpan-123 closed 6 years ago
Also am recieving these values in my console. Whenever i try to send the message to any user.
parameters: {
event = {
environment = development;
"event_type" = "one_shot";
message = "WHhoeGh4aA==";
"notification_type" = push;
user = {
ids = 48723041;
};
};
}
2018-04-30 18:05:49.990675+0530 GAN[3286:1967715] [QMChatCache] Dialogs to insert 0, update 1
Error reasons:{
errors = (
"No one can receive the message"
);
}
Hi,
"No one can receive the message"
This indicates that there is no subscription to push notifications from the users, that you trying to send a push notification to. Please follow this guide on how to create and manage subscriptions: https://quickblox.com/developers/SimpleSample-messages_users-ios#Giving_a_user_a_Push_Notification_subscription
But if that person is currently doing chat with me then he/she is receiving the message. And they are not ony receive the push notification. When my application is in background or application not running.
So my main concern how the user is able to receive push notification when the app open. If they are not able to receive the push notification when the app closed.
How does the push notification in the opened app look like? Do you see it in the log or ?
They are showing a custom pop up from the top not the Bydefault push notification header.
Like you are able to see in the above image.
Well, the thing you see is not a push notification. It is local in-app message notification, which does not have anything related to the guide I've linked to you above.
Okay, Just tell me one things when we do chat one to one and one of the user closed the application and then another user send the message. So in that case should i receive the notification or not?
You will receive push notification when app is closed only if you have subscribed for them.
For subscription am using this function should am doing in the correct way or not.
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let tokenParts = deviceToken.map { data -> String in
return String(format: "%02.2hhx", data)
}
let token = tokenParts.joined()
UserDefaults.standard.set(token, forKey: "device_token")
print("Device Token: \(token)")
let deviceIdentifier: String = UIDevice.current.identifierForVendor!.uuidString
let subscription: QBMSubscription! = QBMSubscription()
subscription.notificationChannel = QBMNotificationChannel.APNS
subscription.deviceUDID = deviceIdentifier
subscription.deviceToken = deviceToken
subscription.devicePlatform = "iOS"
QBRequest.createSubscription(subscription, successBlock: { (response: QBResponse!, objects: [QBMSubscription]?) -> Void in
//
print(response)
}) { (response: QBResponse!) -> Void in
//
print(response.error)
}
}
It should work, just run it and see which block will be executed.
am getting the status code 201, when ever this block is executed.
object: ( { subscription = { device = { "bundle_identifier" = "comm.ParkPad.com.SunSoft"; "client_identification_sequence" = c6872764ec43572399789d64b9e54395867e00adb4b512e45d342077c49c7494; platform = { name = ios; }; udid = "EB8B6097-099B-4ECF-9331-030361EB2DDD"; }; id = 43958104; "notification_channel" = { name = apns; }; }; } )
201 indicates that subscription was successfully created, please once again follow this page as it contains everything you need to know about push notifications and subscriptions: https://quickblox.com/developers/SimpleSample-messages_users-ios#Giving_a_user_a_Push_Notification_subscription
And if you will have any problems, then use Issues to report them here.
Am getting frustrated right now, I want to purchase your plan. But just tell me how should i receive the push notification. I have uploaded the certificates on the QuickBlox Admin panel. What am doing wrong. I have check your demo. And i have implement in the same way.
You said that you've created subscription above. Send a message to that user and check whether he will receive the push notification. Make sure you have chat alerts enabled in your admin panel: https://quickblox.com/developers/Chat#Alerts
Thanks Team, am sorry am trying to get the push notification from last 3 days. Now i get the push notification.
Hi @darpan-123, if you will have any other problems or questions please let us know by creating a separate issue.
@darpan-123 , can you please guide me on the solution you added.
Hello Team, am not able to receive push notification when my app is in background mode or not running. But when my app is open then only am able to receive the push notification in Chat Module. Am not able to understand why its happening and whats going wrong.
I have uploaded the certificates on QuickBlox admin panel. Should i mention any where that am using production mode or debug mode.
So please team, lemme know if am doing something wrong for push notifications settings.