0

所以,在咬牙切齿之后,我终于设法让推送通知在 Apple 的开发沙箱环境中工作。一切都很好 - 我正在使用带有 Push.alert 的非常基本的代码,效果很好 - 这是一个示例:

            try {
                Push.alert(message, "dev_cert.p12", "xxxxxxxx", false,
                            r.getToken());
                rdr.setLastNotified(new java.util.Date());
            } catch (CommunicationException e) {
                e.printStackTrace();
            } catch (KeystoreException e) {
                e.printStackTrace();
            }

虽然我可以看到消息出现在下拉菜单中,以及屏幕顶部的小滚动通知,但应用程序本身没有徽章编号!是什么赋予了??我错过了什么吗?

4

1 回答 1

0

Ok, so I found the "fix" - the fix involves actually reading the documentation of JavaAPNS - simply use this API:

try {

    // message (String), badge # (int), sound (String), certificate (String), password (String), production (boolean true/false - false is for sandbox), token (String)

Push.combined(message, 1, null, cert, "verysecretpassword", false, r.getToken());


        } catch (CommunicationException e) {
            e.printStackTrace();
        } catch (KeystoreException e) {
            e.printStackTrace();
        }
 }

Now sadly, the iphone has no way of keeping a track of the NUMBER of the badge (it does not auto-increment), you the developer must keep a track of that on the server.

于 2012-12-07T18:26:09.507 回答