This question is locked. New answers and comments are not allowed.
Hi,
I have a windows apps to test push notification with the code as below.
I try to send Push based on the devices hardwareIDs / UUIDs.
However, in the Telerik Backend Services' Push list, I see the Push item as:
If I send manually I can see
Is there something wrong with my VB codes?
Thanks.
I have a windows apps to test push notification with the code as below.
I try to send Push based on the devices hardwareIDs / UUIDs.
Private Sub btn_send_push_notification_Click(sender As Object, e As EventArgs) Handles btn_send_push_notification.Click Dim str_msg As String = "(3) - Pls inform HS if you got this. TQ." Dim dt As New DataTable Dim dc = New DataColumn dc.ColumnName = "hardwareID" dt.Columns.Add(dc) Dim dr As DataRow dr = dt.NewRow dr("hardwareID") = "4f8973a567f820c1" dt.Rows.Add(dr) dr = dt.NewRow dr("hardwareID") = "8d2cdcf8958a1f98" dt.Rows.Add(dr) 'TODO: pull devices ID from database ' construct a filter Dim hardwareIds As String() = New String(dt.Rows.Count) {} For Each dr In dt.Rows hardwareIds(dt.Rows.IndexOf(dr)) = dr("hardwareID") Next ' specifies that only Android users will get the notification ' for all devices with a hardware id in the hardwareIds array Dim notificationFilter = New Dictionary(Of String, Object)() From { _ {"HardwareId", New Dictionary(Of String, String())() From { _ {"$in", hardwareIds} _ }} _ } Dim notification = New PushNotification() ' add the notification filter notification.Filter = Telerik.Newtonsoft.Json.JsonConvert.SerializeObject(notificationFilter) 'ANDROID Dim androidNotificationPayload = New Dictionary(Of String, Object)() From { _ {"data", New Dictionary(Of String, Object)() From { _ {"title", _str_app_name}, _ {"message", str_msg}, _ {"customData", "customdata-123456"} _ }} _ } notification.Android = New Telerik.Everlive.Sdk.Core.Model.System.Push.Android.AndroidNotification() For Each pair As KeyValuePair(Of String, Object) In androidNotificationPayload notification.Android.SetValue(pair.Key, pair.Value) Next 'IOS Dim iosNotificationPayload = New Dictionary(Of String, Object)() From { _ {"aps", New Dictionary(Of String, Object)() From { _ {"alert", str_msg}, _ {"sound", "default"}, _ {"badge", 1}, _ {"category", ""} _ }}, _ {"customData", New Dictionary(Of String, Object)() From { _ {"123456", "customdata"} _ }} _ } notification.iOS = New Telerik.Everlive.Sdk.Core.Model.System.Push.IOS.IOSNotification() For Each pair As KeyValuePair(Of String, Object) In iosNotificationPayload notification.iOS.SetValue(pair.Key, pair.Value) Next Dim settings = New EverliveAppSettings() With { _ .ApiKey = _telerik_backend_services_API, _ .UseHttps = False _ } Dim app = New EverliveApp(settings) Dim result = app.WorkWith().Push().Notifications().Create(notification).ExecuteSync() txt_result.Text = txt_result.Text & result.ToString End SubHowever, in the Telerik Backend Services' Push list, I see the Push item as:
Send to:
Devices that match all of the following:If I send manually I can see
Send to:Devices that match any of the following: HardwareId
is
4f8973a567f820c1Is there something wrong with my VB codes?
Thanks.