码迷,mamicode.com
首页 > 编程语言 > 详细

Java APNS开源库apns4j-1.0.1发布

时间:2015-04-23 17:29:48      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:java apns   apns4j   

Java APNS开源库apns4j-1.0.1发布


开源地址:https://github.com/teaey/apns4j


maven依赖:

        <dependency>
            <groupId>com.github.teaey</groupId>
            <artifactId>apns4j</artifactId>
            <version>1.0.1</version>
        </dependency>


使用方法:使用方法


KeyStoreWraper keyStore = KeyStoreHelper.getKeyStoreWraper("XXXXXXXX.p12", keyStorePasswd);

AppleNotificationServer appleNotificationServer = new AppleNotificationServer(AppleGateway.ENV_DEVELOPMENT, keyStore);

SecurityConnectionFactory connectionFactory = new SecurityConnectionFactory(appleNotificationServer);

SecurityConnection connection = connectionFactory.getSecurityConnection();

NotifyPayload notifyPayload = new NotifyPayload();

//notifyPayload.setAlert("TEST1");

notifyPayload.setBadge(2);

notifyPayload.setSound("default");

notifyPayload.setAlertBody("Pushed By apns4j");

notifyPayload.setAlertActionLocKey("Button Text");

connection.writeAndFlush(deviceTokenString, notifyPayload);

connection.close();


有疑问请留言,或者联系本人:

微博:@冲杯茶喝


Java APNS开源库apns4j-1.0.1发布

标签:java apns   apns4j   

原文地址:http://blog.csdn.net/teaey/article/details/45223845

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!