1. I have User1 on iPhone, User2 on iPad, User3 on iPhone running following code as app minimised.
2. Now i want to send notification to only user: User3 on iPhone
3. Why does all User1, User2, User3 is getting notification?
My goal is to send it to only the target user.
I just want to send to User3 not to all.
B4X:
Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private Const ServerUrl As String = "http://192.168.1.32:51044"
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
NavControl.ShowPage(Page1)
App.RegisterUserNotifications(True, True, True)
App.RegisterForRemoteNotifications
End Sub
Private Sub Application_PushToken (Success As Boolean, Token() As Byte)
If Success Then
Dim bc As ByteConverter
Dim j As HttpJob
j.Initialize("j", Me)
j.PostString(ServerUrl & "/devicetoken", "token=" & bc.HexFromBytes(Token) & "&type=1")
Else
Log("Error getting token: " & LastException)
End If
End Sub
Private Sub JobDone(j As HttpJob)
If j.Success Then
Log("Token uploaded successfully.")
Else
Log("Error uploading token")
End If
j.Release
End Sub
Private Sub Application_RemoteNotification (Message As Map)
Log("Remote notification: " & Message)
Dim m As Map = Message.Get("aps")
Log(m)
Log(m.Get("alert"))
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Private Sub Application_Background
End Sub
2. Now i want to send notification to only user: User3 on iPhone
B4X:
http://192.168.1.32:51044/send?password=123&text=wakeup_User3
3. Why does all User1, User2, User3 is getting notification?
My goal is to send it to only the target user.
I just want to send to User3 not to all.