To get push notifications from ntfy (ntfy.sh), my app has to register to intents with the "io.heckel.ntfy.MESSAGE_RECEIVED" action. I have installed the ntfy app . In my own app I have the following code in manifest:
In Receiver Module named ntfyPush, I have this code:
However I am not getting any notification when I try to send notification using ntfy web app . Do I need to do anything else apart from what I have done above to get push notification?
Manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
- -- ------
----------
'End of default text.
AddReceiverText(ntfyPush,
<intent-filter>
<action android:name="io.heckel.ntfy.MESSAGE_RECEIVED" />
</intent-filter>)
ntfyPush Receiver Module:
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
Log(StartingIntent)
Dim b As Beeper
b.Initialize(500,500)
b.Beep
Sleep(500)
b.Release
If StartingIntent.Action = "io.heckel.ntfy.MESSAGE_RECEIVED" Then
Log("Topic: " & StartingIntent.GetExtra("topic"))
ToastMessageShow(StartingIntent.GetExtra("topic"),True)
Log("Message: " & StartingIntent.GetExtra("message"))
ToastMessageShow(StartingIntent.GetExtra("message"),True)
End If
End Sub