How to show Confirm / False options for Push Notifications?

I would like to implement Confirm and False options for users to reply to Push Notification from iOS’s notification area. You can check the attached image for reference.
http://support.backendless.com/public/attachments/5d8eebdacf326fd62e999540abdffffd.jpg</img>
I checked Backendless documentation but couldn’t find any API to for this. https://backendless.com/documentation/messaging/android/messaging_publish_push_notifications.htm
Let me know if this is something possible with Backendless.
Thanks

I suppose this is in the way you handle the received notification in your code, not in Backendless API. So in your push receiver code you may create any options you like in the UI, and just use the information received from the push notification.

I wrote this code to display Confirm and Cancel for push notification
But I am still getting regular push notification instead of actionable push.

let viewAction1 = UIMutableUserNotificationAction()
        viewAction1.identifier = "ConfirmNotification"
        viewAction1.title = "Confirm"
        viewAction1.activationMode = .Foreground
        
        let viewAction2 = UIMutableUserNotificationAction()
        viewAction2.identifier = "FalseNotification"
        viewAction2.title = "False"
        viewAction2.activationMode = .Foreground
        
        let newsCategory = UIMutableUserNotificationCategory()
        newsCategory.identifier = "PUSH_CATEGORY"
        newsCategory.setActions([viewAction1,viewAction2], forContext: .Default)
        
        let categories: Set<UIUserNotificationCategory> = [newsCategory]
        
        let notificationSettings = UIUserNotificationSettings(forTypes: [.Badge, .Sound, .Alert], categories: categories)
        application.registerUserNotificationSettings(notificationSettings)


        backendless.messaging.registerForRemoteNotifications()

If you want to implement feedback action on push notifications, you should do this in the code of you mobile application. Maybe it will be useful to add some meta-information to push notification for proper processing.

Oleg,

That’s what I did and shared the code in my previous post. Could you please check what’s wrong there? I feel these are common things while developing mobile apps and providing samples to implement this would be really helpful.

Thanks

Rajat,

When you publish your notification, add the following header:

“ios-category”:“ACTIONABLE”

Please let me know if that did the trick.

Regards,
Mark

Hello Mark,

The trick didn’t work. Here is the code I am using for actionable push notifications. Let me know if anything is missed out in code or any other approach I should try.

func publishMessageAsPushNotificationAsync(message: String) {
 let publishOptions = PublishOptions()
 publishOptions.assignHeaders(["ios-category":"ACTIONABLE"])
 backendless.messaging.publish("\(NSUserDefaults.standardUserDefaults().valueForKey(kCurrentUserEmail)!)", message: message, publishOptions:publishOptions,
 response:{ ( messageStatus : MessageStatus!) -> () in
 print("MessageStatus = \(messageStatus.status) ['\(messageStatus.messageId)']")
 },
 error: { ( fault : Fault!) -> () in
 print("Server reported an error: \(fault)")
 }
 )
 }

Your quick answer is highly appreciated.

Thanks
Rajat

To add more details on the same, when I added ios-sound: default in publishOptions.assignHeaders, it didn’t work too. Let me know if I am doing anything wrong while setting push headers here.

Thanks
Rajat

@Support, appreciate if you could let me know any other approach I can try at the earliest.

Thanks

Can somebody from support provide me a definite answer for Actionable Push? We have already spend more than enough time on it and your definite answer is highly appreciate now.

I checked all combination in code and from Backendless push testing panel but not able to send actionable push notification with Confirm/Cancel option.

I have already shared my code on support and you can check the code as well.

Thanks

Hi Rajat,

We added "categories" property in MessagingService class, so now interactive notification is allowed.
You could investigate our sample project (see in attachment) which demonstrates this feature.

To use it in your project you should update backendless.a from attached project or from ios-SDK github.

Regards,
Slava

TestPushNotify.zip (19.55MB)

Thanks Slava. Let me check your sample and update you with result.

Wanted to know, if there is any way I can send push notification to the entire channel except me. The requirement is to send push notifications to all devices logged-in using same account/login/credentials. The detector device will show local notification as the App should work without internet as well. If internet is available then device needs to send Push to other devices and show local notification at its own end.

Let me know, if there is any direct API available to achieve this.

Thanks

Somehow we manage to get the Push with Confirm / False. Thanks support for helping us.

But that’s not all. I wanted to know if there is any API available that sends push notifications to all devices except my own device. A quick help is highly appreciated.

Thanks

Hi Rajat,

You cannot exclude a device from the recepients, but you can specify the devices to which you want to send notification: https://backendless.com/documentation/messaging/ios/messaging_publish_push_notifications.htm

Also you may try to take advantage of subtopics: https://backendless.com/documentation/messaging/ios/messaging_message_publishing.htm

There is Swift3/iOS10 sample project, which demonstrates the interactive push (“ios-category”).

You could investigate it and use backendless.a lib (/Pods/Backendless/SDK/ios/backendless) in your projects. We will release new pod version soon.

TestS3PushActions.zip (19.31MB)