TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Basit Khan
NA
336
121.6k
Push up notification for Google chrome
Sep 29 2016 7:14 AM
Hi,
Push up notification for google chrome.
I have created FCM cloud messaging services in google.
I have two question
1) How to get the register ID of Google Chrome.
2) How to send the message to client/Google Chrome.
I did in android to send the message with the below code.
i got the google chrome id from GCM Notification extension from chrome extension.
then i tried to send with below code saying senderIDMismatch, below code working fine in android device.
Private Sub Frm_SendNotification()
Dim RegId As String
Dim ApplicationId As String
Dim SENDER_ID As String
RegId = ""
ApplicationId = ""
SENDER_ID = ""
Dim value = TextBox1.Text
'message text box
Dim tRequest As WebRequest
tRequest = WebRequest.Create("https://android.googleapis.com/gcm/send")
tRequest.Method = "post"
tRequest.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"
tRequest.Headers.Add(String.Format("Authorization: key={0}", ApplicationId))
tRequest.Headers.Add(String.Format("Sender: id={0}", SENDER_ID))
'Data post to the Server
Dim postData As String = (Convert.ToString("collapse_key=score_update&time_to_live=108&delay_while_idle=1&data.message=" + value + "&data.time=" + System.DateTime.Now.ToString() + "®istration_id=") & RegId) + ""
Console.WriteLine(postData)
Dim byteArray As [Byte]() = Encoding.UTF8.GetBytes(postData)
tRequest.ContentLength = byteArray.Length
Dim dataStream As Stream = tRequest.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim tResponse As WebResponse = tRequest.GetResponse()
dataStream = tResponse.GetResponseStream()
Dim tReader As New StreamReader(dataStream)
Dim sResponseFromServer As [String] = tReader.ReadToEnd()
'Get response from GCM server
Label1.Text = sResponseFromServer
'Assigning GCM response to Label text
tReader.Close()
dataStream.Close()
tResponse.Close()
Thanks
Basit.
End Sub
Reply
Answers (
1
)
how to retrive binary data in mssql on listview eval
how to create a session in controler use in Class using MVC4