Hello all,
Maybe this is a silly question, i was able to implement silent notifications and regular push notifications. Im using the UserNotificationClass from Erel.
My problem is that when the user clicks on any action of the buttons it only gets the actionIdentifier string (that is the button name), but in some cases depending on the pushed notification I need to use extra information to perform other actions, i was able to send this additional information inside the JSON 'data' node sent from server, and received correctly in the Application_RemoteNotification event, but this extra information is not stored in the "CreateAction" routine from the UserNotificationClass, so, when the user clicks on any action i just see the actionIdentifier.
So, when i debug the code and when the UserNotification_Action trigers i was able to see for a few seconds that inside the treeview of the native object there is the information needed Inside _request and inside _identifier tags, i tried to retrieve it using nativeObject with the GetField method, but the App crashes. There is a way to get this info??, or there is another way to get the proper information of the identifier and the button actions??. Please help!!
Many thanks to all in advance!
Here my code:
Maybe this is a silly question, i was able to implement silent notifications and regular push notifications. Im using the UserNotificationClass from Erel.
My problem is that when the user clicks on any action of the buttons it only gets the actionIdentifier string (that is the button name), but in some cases depending on the pushed notification I need to use extra information to perform other actions, i was able to send this additional information inside the JSON 'data' node sent from server, and received correctly in the Application_RemoteNotification event, but this extra information is not stored in the "CreateAction" routine from the UserNotificationClass, so, when the user clicks on any action i just see the actionIdentifier.
So, when i debug the code and when the UserNotification_Action trigers i was able to see for a few seconds that inside the treeview of the native object there is the information needed Inside _request and inside _identifier tags, i tried to retrieve it using nativeObject with the GetField method, but the App crashes. There is a way to get this info??, or there is another way to get the proper information of the identifier and the button actions??. Please help!!
Many thanks to all in advance!
Here my code:
RemoteNotificationEvent:
Public Sub Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)
Dim elTitulo As String=Message.Get("title")' mapa1.Get("title")
Dim elCuerpo As String=Message.Get("body")
Dim laYave As String=Message.Get("yave")'Here I receive additional info
Dim elAviso As String=Message.Get("aviso")'here too
If laYave<>Null And elAviso<>Null Then
Select elAviso
Case "A"'
UNC.SetCategoryActions("cate1",Array("Dejar de recordar"))
UNC.CreateNotificationWithContent(elTitulo, elCuerpo, laYave, "cate1", 4000)'Here i send as an identifier the a key string to use later if the user clicks on any action'
'additional cases below'
Case "B"
Case "C"
Case "D"
Case "P"'
Case "X"
Case Else
End Select
End If
CompletionHandler.Complete
End Sub
User Notification action event:
Public Sub UserNotification_Action (Response As Object)
Dim n As NativeObject = Response
Dim ActionIdentifier As String = n.GetField("actionIdentifier").AsString
'this were different attemps to get the info below the identifier key i see in the debug for a few seconds, i see the information is there, i just need the correct method to get it'
'Dim no As NativeObject=n.GetField("_request")
'Dim ni As NativeObject=no.GetField("content")
'Dim elcat As String=ni.GetField("categoryIdentifier").AsString
'Dim micat As String=n.GetField("categoryIdentifier").AsString'
'Dim eliden As String=n.GetField("requestWithIdentifier").AsString
'Msgbox($"User clicked on : ${ActionIdentifier}"$, "")
Log(ActionIdentifier)
End Sub