简体   繁体   中英

Quickblox chat using quickblox

I am working on chat module of application using quickblox. It is working properly. But i am not receiving any push notification for chat message while the application is terminated.Can any one help me in this?

As you want to received Push Notification, for that you need to verify the below steps.

Step 1: Setup all certificates and passphrase to send notification in quickblox Portal.

  • Login to quickblox portal.
  • Select you created application.
  • Click on "Push notification" menu from left menu list.
  • Click on "Settings" menu from top right tabs.
  • In settings section you need to set all relative certificates and keys.

Step 2: After setting up all the information need by quickblox portal. You need to add code in you application for subscribe to get notification for login user's device.

NSString *deviceIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
QBMSubscription *subscription = [QBMSubscription subscription];
subscription.notificationChannel = QBMNotificationChannelAPNS;
subscription.deviceUDID = deviceIdentifier;
subscription.deviceToken = <Replace-Device-Token-Here>;
[QBRequest createSubscription:subscription successBlock:^(QBResponse *response, NSArray *objects) {
    // Success.
} errorBlock:^(QBResponse *response) {
    // Error.
}];

Step 3: Once user perform logout action then you need to unsubscribe the push notification from quickblox server to stop receiving notification to registered device.

NSString *deviceUdid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[QBRequest unregisterSubscriptionForUniqueDeviceIdentifier:deviceUdid successBlock:^(QBResponse *response) {
    // Success.
} errorBlock:^(QBError *error) {
    // Error.
}];

Let me know if you have any comment on the same.

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM