I have used Quickblox iOS SDK for chat implementation. I am facing problem with push notification from iOS device to android device. By default it should send push to opponent user whenever a message is sent.It does not send push from iOS to Android, however it works fine from iOS to iOS. We have tried following code for sending universal push notification.
NSDictionary *payload = @{
@"message" : @"Test Message",
@"ios_sound" : @"mysound.wav",
@"user_id" : [NSString stringWithFormat:@"%@",obj],
@"thread_id" : @"10"
};
NSData *data = [NSJSONSerialization dataWithJSONObject:payload options:NSJSONWritingPrettyPrinted error:nil];
NSString *messageTosend = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
QBMEvent *event = [QBMEvent event];
event.notificationType = QBMNotificationTypePush;
event.usersIDs = [NSString stringWithFormat:@"%@",obj];//obj is receiver's ID
event.type = QBMEventTypeOneShot;
event.message = messageTosend;
[QBRequest createEvent:event successBlock:^(QBResponse *response, NSArray<QBMEvent *> *events) {
// Successful response with event
} errorBlock:^(QBResponse *response) {
// Handle error
}];
for the above code i am getting status code as 201 but no notification at android device side.
another code i tried is following:
[QBRequest sendPushWithText:message toUsers:[NSString stringWithFormat:@"%@",obj] successBlock:^(QBResponse * _Nonnull response, NSArray<QBMEvent *> * _Nullable events) {
} errorBlock:^(QBError * _Nonnull error) {
}];
NOTE: in the above code "obj"is receiver's ID.
any help will be appreciated.
thanks in advance.