Dear All
I have problem when send FCM message to user when use listen using FirebaseMessaging.Token
My program have no problem when sending to "test", "all" .
There anyone experience with this problem
I have problem when send FCM message to user when use listen using FirebaseMessaging.Token
My program have no problem when sending to "test", "all" .
There anyone experience with this problem
Androidpushnotif.vb:
Imports Newtonsoft.Json
Imports System.Net
Imports System.Text
Public Class AndroidPustNotif
Private urlToPost As String = ""
Private urlkey As String = ""
Public Sub New(ByVal urlToPost As String, ByVal urlkey As String)
Me.urlToPost = urlToPost
Me.urlkey = urlkey
End Sub
Public Function postData(ByVal dictData As Dictionary(Of String, Object)) As Boolean
Dim webClient As New WebClient()
Dim resByte As Byte()
Dim resString As String
Dim reqString() As Byte
Try
webClient.Headers("content-type") = "application/json" ';charset=UTF-8
webClient.Headers.Add("Authorization", "key=" & Me.urlkey)
reqString = Encoding.Default.GetBytes(JsonConvert.SerializeObject(dictData, Xml.Formatting.Indented))
resByte = webClient.UploadData(Me.urlToPost, "post", reqString)
resString = Encoding.Default.GetString(resByte)
Console.WriteLine(resString)
webClient.Dispose()
Return True
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Return False
End Function
End Class