-
Notifications
You must be signed in to change notification settings - Fork 9
Code examples in readme are not clear #89
Comments
@GlenMasters That code is for identifying when app opened through clicking a notification.
Eg;
|
@AnanthaKrish Thanks for your response. We have added the code as you have specified, however we now get a fatal error at runtime. This is the full content of our AppDelegate.m
The error we are receiving is in attached screen shot: |
@GlenMasters Try replacing the code like this,
|
Your suggested code snippet compiles and runs without the fatal error. However it does not expose the identifierName field that we were expecting. |
@GlenMasters If you want actionable notifications identifier , please remove the code from Remove this;
and implement this
|
@AnanthaKrish |
@GlenMasters Are you clicking on the action button to open the app ? Or just taping on the notification ? |
@AnanthaKrish |
@GlenMasters in iOS if you just tap there is no identifierName will come. If you tap on the action button then teh identifier name will come ... |
What is the action button? I do not follow. |
Actionable push notification. You have to pass the |
Ok tried that - does not make any difference. I still just get a standard notification - and no identifier when I click on it. Here is my code for initialisation - copied from the documentation:
and for handling the notifications:
|
@GlenMasters You have to send the identifier name in the push notification. In Dashboard check the ios section , you'll see |
I am not sure that this is going to get me what I want - which is to be able to determine whether my user has received and is responding to the notification. The notification callback handler is invoked both, when the app is in the background and the user taps on the notification, and when the app is in the foreground (and therefore no notification was received). I need to be able to determine which scenario has occurred as the behaviour of the app is different in each case. (We navigate to relevant content in response to the notification tap, but alert the user to the notification when the app is in the foreground). This behaviour seems to work for BMS in Android but not in IOS. |
@GlenMasters to identify the notification click (Not through the notification action click ), add the below code in
|
@AnanthaKrish Thanks for that. I am looking into supporting interactive (actionable?) notifications, in addition to regular ones. Below is the IOS-code, from the sample, I am using now. How would a full sample for supporting interactive notifications as well look?! Cheers // Register device token with Bluemix Push Notification Service
} // Handle error when failed to register device token with APNs
} // Handle receiving a remote notification
|
On Android it seems quite easy, just add the options like @GlenMasters did above, and the buttons shows up in the notification. Hitting a button then opens the app, with info om which IdentifierName was selected. I assume not possible to not bring the application to front? |
@tverilytt You have to pass the categoryName in iOS field also from Push dashboard (Or REST API). |
@AnanthaKrish Thanks. I was thinking if it was possible to take some direct action, when clicking a notification buttion, without having to open the application itself. I am a bit confused on your code change proposals, so would be great to see a full code sample for handling actionable push notifications for IOS :-) Cheers |
@tverilytt If you are asking about adding a text field in push notifications, its not possible with the current implementation. Please send a silent push notification from push service and create a local notification from the device , which have custom Handling options. |
@AnanthaKrish Ok, thanks, good suggestion :-) So no need to add anything particular to IOS code for handling actionable push notifications? /HNADLE THE NOTIFICTAION CLICK
} |
@tverilytt Yes you have to . Make the changes in the in Create a local notification there and add the actions you need. |
I am struggling to get interactive notifications to work, below is my current AppDelegate, am I missing something?! EDIT: When app is running in background, it seems to have to be brought to foreground for the notification action to run (the app is not brought to foreground when (licking a notification buttion...). // Register device token with Bluemix Push Notification Service
} // Handle error when failed to register device token with APNs
} // Handle receiving a remote notification
// Handle receiving a remote notification on launch
// jo2mod // if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) { } //HNADLE THE NOTIFICTAION CLICK
} |
In the Objective-C example the following function contains extraneous lines:
Removing the lines -----------
will result in a compiler warning: Control reaches end of non-void function.
The instructions say "Add the code below to your application delegate:"
The existing application delegate contains the following definition:
It is not clear whether the function "didFinishLaunchingWithOptions" is meant to replace the existing code in the delegate or replace it.
In our tests, using the code from the example compiles but fails at runtime, whilst the original code executes but clearly does not contain the same logic.
The text was updated successfully, but these errors were encountered: