Apple Push Notification Service (APNS) not showing buttons (OSx App)? - macos

I am trying to add push notification service (Remote) to my OSX app. I send the following payload and was able to get notification in my desktop. But the issue is with buttons.
{
"aps": {
"alert": {
"title": "Game Request",
"body": "Bob wants to play poker",
"action-loc-key": "PLAY"
},
"badge": 5
},
"acme1": "bar",
"acme2": ["bang", "whiz"]
}
I am able to get the notification, but the button "Play" will show
up only if I hover over the notification. Any thoughts on this behavior?
Also, Can I add multiple buttons as part of remote push notification
?
I found some samples on iOS, but no concrete samples regarding OSx. Any help or guidance really appreciated.

By default "Notification style" is banner on OSx. Only for "Alert" style It will show buttons. So changing to "Alert" it starts showing buttons.

Related

Azure pushnotification action modification

I am using Azure notification hub to send push notification(xamarin forms). I have follow below example. and its working fine.
Example
I have an issue when push notification coming when app is open. this sample shows and popup when notification coming when user using the app.
This is the JSON code
{
"text": "Message from Postman!",
"action": "action_a"
}
public override void OnMessageReceived(RemoteMessage message)
{
if (message.Data.TryGetValue("action", out var messageAction))
NotificationActionService.TriggerAction(messageAction);
}
This shows popup called " ActionA action receved". I need to show my text message for this. I tried many ways but i couldn't modify it.

Open notification in Xamarin.Forms

How can I open a notification in Xamarin. Forms?, I have implemented that receives and shows the notifications even if it is inside the application but I lack the action of the notification, not that to do...
I think you want to fire an action when user clicks your "OK" button on your message which includes notification message. I suggest you to use a custom dialog project like this:
Acr.UserDialogs
When you import that library, u can call a message and give an action method to its interface: (code may not compile, i wrote it randomly)
UserDialogs.Instance.Alert(new AlertConfig
{
Message = "Your notification message",
OkText = "OK",
OnAction = ()=>{/*youraction*/}
});
So when user taps on "OK" your action code will run. Do not forget to use "Device.BeginInvokeOnMainThread" method if you make UI changes:)

NativeScript push notifications permission dialog shows behind app

Do you know what could be causing the permissions request dialog on iOS to show behind the app? It actually flashes quickly and then goes behind. I have to press the home button to bring it to the front. Until then the UI is blocked.
I am using Everlive and I am calling the register method in the app's launchEvent as such:
var pushSettings = {
//iOS - specific settings
iOS: {
badge: true,
sound: true,
alert: true,
clearBadge: true
},
notificationCallbackIOS: function (userInfo) {
...
},
//Android - specific settings
android: {
projectNumber: '944301213976'
},
notificationCallbackAndroid: function callback(data) {
...
}
}
el.push.register(pushSettings, function (data) {
...
}, function (error) {
});
Thank you.
EDIT: I should add that I am testing on iOS 9.3.4 and right before the dialog goes behind the app, I get the following warning in the console: enabledRemoteNotificationTypes is not supported in iOS 8.0 and later. Not sure if it matters, but I wanted to mention it, just in case.
So, it turns out that it was a timing issue. I was running the code when the app was initializing. The popup will get displayed, but shortly after, the first screen (login in my case) gets initialized, stealing the focus from the popup.
Once I moved the code in a button tap event (after the screen loading was completed) everything worked as expected.
I am not sure if this is the best way to handle this. I am open for suggestions.
Also, you can see https://github.com/NativeScript/push-plugin/issues/38 for more info. Thank you Anton Dobrev for pointing me to the right direction.

Mac OS X 10.8 NSUserNotification alert notification don't get dismissed

In our app we are displaying Notifications in alert style.
Displaying notification is working fine and we also get callback when user interacts with the notification either by clicking on notification or by clicking on Action button.
But the Alert Notification Pop up stay on the screen instead of going away even after user has dismissed it by clicking on the content of the notification.It goes away only after clicking close button.Pop up stay on the screen where as notification get cleared from notification center.
Is there is any solution to dismiss pop up when user click the content of alert notification.
You'll need to handle this manually. Implement the delegate method -userNotificationCenter:didActivateNotification: like this:
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
{
if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) {
[center removeDeliveredNotification:notification];
}
}

How do I remove categories from UIUserNotificationSettings?

The docs for UIUserNotificationSettings is here.
Previously, I added a category to the UIMutableUserNotificationCategory and was able to get custom actions/buttons in the system notifications for iOS 8. Now, I want to remove them. I removed that code but when I tested the push notification with that category, the custom action still shows up.
My guess is that the notification settings is saved the the UIUserNotificationSettings which I don't have control over. Uninstalling and reinstalling the app does not seem to reset the notification settings for my app.
How do I get the app to stop responding to custom actions triggered by a category?
Thanks!
PS: An example payload that I used for the push notification which still works after I removed the code from the app:
{ "alert": "asdf", "sound": "default", "category": "AN_ACTION" }

Categories

Resources