Hi, Guys
Some old posts on the forum suggest that to send a message to a specific device you replace the topic string in the Send() sub with the recipient's device's token.
As I understand the code from Erel's tutorial [B4X] Firebase Push Notifications 2023+ I replace the topic string (originally "general") with the target device's token (i.e. something like "dj7Wz7ukQYe83L-fP4.......")
The simple question is "Is this correct?" or should (with the latest Firebase API) it be done another way.
However, I did try it and it did not work.
Kind regards
Dave
Some old posts on the forum suggest that to send a message to a specific device you replace the topic string in the Send() sub with the recipient's device's token.
As I understand the code from Erel's tutorial [B4X] Firebase Push Notifications 2023+ I replace the topic string (originally "general") with the target device's token (i.e. something like "dj7Wz7ukQYe83L-fP4.......")
Sending to a single device:
Private Sub Send (topic As String, title As String, body As String)
Dim Token As String = GetTokenValue(ServiceAccountFilePath)
Wait For (SendMessage(topic, title, body)) Complete (Success As Boolean) 'B4A - commend if not needed
Wait For (SendMessage("ios_" & topic, title, body)) Complete (Success As Boolean) 'B4i - comment if not needed
ExitApplication
End Sub
Private Sub SendMessage(Topic As String, Title As String, Body As String) As ResumableSub
Dim Job As HttpJob
Job.Initialize("", Me)
The simple question is "Is this correct?" or should (with the latest Firebase API) it be done another way.
However, I did try it and it did not work.
Kind regards
Dave