Is it possible to push notes from a windows forms application?
.net 4.8 - visual basic
mvh ravno data
Is it possible to push notes from a windows forms application?
.net 4.8 - visual basic
mvh ravno data
This should be possible. The protocol used by e.g. exponent_sdk_python
is just JSON over HTTP. You would need to translate from one of the exponent_sdk_* versions to Visual Basic or some other language that runs on .Net.
Here’s the Python code, for example.
See also this:
https://docs.expo.io/versions/latest/guides/push-notifications/#http2-api
I’m using code like this:
Sub PushExpoNote()
Dim request As WebRequest = WebRequest.Create("https://exp.host/--/api/v2/push/send")
Dim expoData As String = "{""to"":""@Token@"",""Title"":""@Title@"",""Body"":""@Body@""}"
expoData = expoData.Replace("@Token@", "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxxx]")
expoData = expoData.Replace("@Title@", "Hello")
expoData = expoData.Replace("@Body@", "World")
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(expoData)
request.Method = "POST"
request.ContentType = "application/json"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As StreamReader = New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
reader.Close()
dataStream.Close()
request = Nothing
expoData = Nothing
dataStream.Dispose()
response.Dispose()
reader.Dispose()
responseFromServer = Nothing
End Sub
and gets serverresponse like:
“{“data”:{“id”:“1234c44a-5c1a-4309-928a-a5eda33312dd”,“status”:“ok”}}”
But the notification never shows on my device - neither IOS nor Android.
Problem Solved:
Expo seems to be case sensitive.
Changed “Title” to “title” and “Body” to “body” in expodata and it works.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.