iOS Question B4I - PushServer not sending messages to any devices

IamTrying

Active Member
Licensed User
I am running PushServer and trying to catch push messages to B4I device. But i am not getting anything. Here was my following attempt:

1. PushServer

config.txt
======
B4X:
#push server configuration
#http://192.168.1.32:51044/send?password=123&text=Message
#path to the keystore file. Use unix style slashes:
iPushKeystore=C:/Users/tpt/Desktop/B4I/push.keystore
#same password as the password set in B4i key settings:
iPushKeystorePassword=xxxx

#change to: gateway.push.apple.com for production
iGateway=gateway.sandbox.push.apple.com
iGateWayPort=2195
#change to: feedback.push.apple.com for production
iFeedback=feedback.sandbox.push.apple.com
iFeedbackPort=2196

AndroidApiKey=AIzaSyAccccccm4KHlrD7CfgRuo

PushServerPort=51044
PushServerPassword=123

running
=====
B4X:
Waiting for debugger to connect...
Program started.
2017-10-18 08:57:17.119:INFO::main: Logging initialized @1306ms to org.eclipse.jetty.util.log.StdErrLog
2017-10-18 08:57:17.454:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT
2017-10-18 08:57:17.556:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2017-10-18 08:57:17.556:INFO:oejs.session:main: No SessionScavenger set, using defaults
2017-10-18 08:57:17.565:INFO:oejs.session:main: Scavenging every 600000ms
2017-10-18 08:57:17.581:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@4cc0edeb{/,file:///C:/Users/tpt/Desktop/android-sample/PushServer/Objects/www,AVAILABLE}
2017-10-18 08:57:17.609:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Users\tpt\Desktop\android-sample\PushServer\Objects\logs\b4j-2017_10_18.request.log
2017-10-18 08:57:17.828:INFO:oejs.AbstractConnector:main: Started ServerConnector@39c0f4a{HTTP/1.1,[http/1.1]}{0.0.0.0:51044}
2017-10-18 08:57:17.829:INFO:oejs.Server:main: Started @2020ms
Emulated network latency: 100ms
server version: 0.97
server is listening on port: 51044
Table: tokens
Feedback Socket connected.
Socket connected.
feedback terminated
2. B4I run

BN2YGCa.png

c2lXGte.png


iFmw6TS.png

yc6n2Zp.png

TCXmIqA.png

B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #ProvisionFile: pushdevelopment.mobileprovision
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    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


Output:
====

B4X:
Application_Start
Application_Pushtoken
Error getting token: <B4IExceptionWrapper: Error Domain=NSCocoaErrorDomain Code=3000 "no valid “aps-environment” entitlement string found for application" UserInfo={NSLocalizedDescription=no valid “aps-environment” entitlement string found for application}>
refreshPreferences: HangTracerEnabled: 0
refreshPreferences: HangTracerDuration: 500
refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
Application_Active

3. Push message to all devices
ASHNxe2.png



What is happening? what is missing?
 
Last edited:
Top