I am trying to send push notification to a specific device but that specific device does not receive notification. I am using the following method:
-(void)sendMessageAsPushNotificationAsync:(NSString *)message forDevice:(NSString *)deviceId
{
DeliveryOptions *deliveryOptions = [DeliveryOptions new];
deliveryOptions.pushSinglecast = (NSMutableArray *) @[deviceId];
[backendless.messagingService
publish:@“default” message:message publishOptions:publishOptions deliveryOptions:deliveryOptions
response:^(MessageStatus *messageStatus)
{
NSLog(@“MessageStatus = %@ <%@>”, messageStatus.messageId, messageStatus.status);
}
error:^(Fault *fault)
{
NSLog(@“FAULT = %@”, fault);
}
];
}
I think the problem is deviceId, I am passing device token to this method, what is deviceId and how can I retrieve it ?
Thanks for you reply, I have already checked this sample, the problem is
‘didRegisterForRemoteNotificationsWithDeviceId’ delegate is not called. I actually want to sent push notification to a specific device and for that i need deviceId, how can I get this deviceId while registering app for push notification ? and registerDeviceToken returns a string that is different from the deviceID saved for the device to my Messages console.
Please see the file attached.
Using these two lines get the deviceId of the device and save it in your database and when ever you want to send push notification to a specific device then get the deviceId of that specific device from your database and then use the method I added in my question on the top.