iospush-notificationapple-push-notificationsjavapns

Why does JavaPNS send production push messages to the sandbox server?


Push notification works for the sandbox.

Then I create a new certificate for Push Production.

The app is in app store now.

The server code call looks like this:

Push.combined(message, badgeCount, DEFAULT_SOUND, KEYSTORE, KEYSTOREPASSWORD, SANDBOX, token)

where SANDBOX is false.

Yet, when the server, using the production P12 file, tells the JavaPNS module to send a push notification, the log looks like this:

396784 [Thread-61] DEBUG javapns.notification.PushNotificationManager - Initialized Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 416e43d7[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.sandbox.push.apple.com/17.149.34.188,port=2195,localport=48070]]

It seems to use the sandbox server.

What could be wrong?


Solution

  • What's wrong is that the parameter to which you pass false is actually called production, which means you should pass true if you wish to connect to the production push env :

    public static PushedNotifications combined(
        String message, int badge, String sound, Object keystore, String password,
        boolean production, Object devices)
      throws CommunicationException, KeystoreException