Push notes from a windows forms application

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:


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()

    request = Nothing
    expoData = Nothing
    responseFromServer = Nothing

End Sub

and gets serverresponse like:

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.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.