Hello,
First of all thank you Backendless for saving me from Parse’s shoutdown.
Every thing is working like a charm … But I have the push notification issue in iOS
My app’s idea is a shopping app. so when a user buy an item… a push notification message should be sent to the admin, which is me and anther person, the other person and I have created a channel called Admin. and we have registered our devices in it with this code
@try {
[backendless initAppFault];
[backendless.messagingService registerDevice:@[@“Admin”];
backendless.messagingService.pushReceiver = self;
}
@catch (Fault *fault) {
//[self showAlert:fault.message];
NSLog(@"-------%@", fault.message);
}
The Channel were created and our devices appears in the devices section and they’ve registered fine with their tokens …
But When I try to send a push notification to it… nothing happen until I open the app and close it again, then send it again and push is here … but if I left the app closed for one hour and send a push again … nothing appears, I’ve tried the Dashboard console as well but nothing, before asking me … my Certs are fresh generated and they are in the correct place. Im using the native header to send a native push like these
“ios-sound”:“default”,“ios-badge”:“1” etc
the code that will send a push looks like this
DeliveryOptions *deliveryOptions = [DeliveryOptions new];
[deliveryOptions pushBroadcast:(/*FOR_ANDROID | */ FOR_IOS)];
[deliveryOptions pushPolicy:PUSH_ONLY];
NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init];
[tempDict setObject:UserNameTextField.text forKey:PUBLISHER_NAME_HEADER];
[tempDict setObject:@"1" forKey:@"ios-badge"];
[tempDict setObject:@"default" forKey:@"ios-sound"];
[tempDict setObject:@"1" forKey:@"ios-content-available"];
PublishOptions *options = [PublishOptions new];
options.headers = tempDict;
[backendless.messagingService
publish:@"Admin"
message:[NSString stringWithFormat:@"%@ Submitted An Item For Review.", UserNameTextField.text]
publishOptions:options
deliveryOptions:deliveryOptions/*[DeliveryOptions deliveryOptionsForNotification:PUSH_ONLY]*/
response:^(MessageStatus *res) {
NSLog(@"showMessageStatus: %@", res);
}
error:^(Fault *fault) {
NSLog(@"sendMessage: fault = %@", fault);
}];
Please let me know if Im doing something wrong that the push notification wont deliver if the app is closed after one hour and up ? Or something else with the backend ?