`
冲杯茶喝
  • 浏览: 29465 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Java APNS开源库apns4j-1.0.1发布

阅读更多

Java APNS开源库apns4j-1.0.1发布

 

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

 

maven依赖:

 

  1.         <dependency>  
  2.             <groupId>com.github.teaey</groupId>  
  3.             <artifactId>apns4j</artifactId>  
  4.             <version>1.0.1</version>  
  5.         </dependency>  



 

使用方法:使用方法

 

 

  1. KeyStoreWraper keyStore = KeyStoreHelper.getKeyStoreWraper("XXXXXXXX.p12", keyStorePasswd);  
  2.   
  3. AppleNotificationServer appleNotificationServer = new AppleNotificationServer(AppleGateway.ENV_DEVELOPMENT, keyStore);  
  4.   
  5. SecurityConnectionFactory connectionFactory = new SecurityConnectionFactory(appleNotificationServer);  
  6.   
  7. SecurityConnection connection = connectionFactory.getSecurityConnection();  
  8.   
  9. NotifyPayload notifyPayload = new NotifyPayload();  
  10.   
  11. //notifyPayload.setAlert("TEST1");  
  12.   
  13. notifyPayload.setBadge(2);  
  14.   
  15. notifyPayload.setSound("default");  
  16.   
  17. notifyPayload.setAlertBody("Pushed By apns4j");  
  18.   
  19. notifyPayload.setAlertActionLocKey("Button Text");  
  20.   
  21. connection.writeAndFlush(deviceTokenString, notifyPayload);  
  22.   
  23. connection.close();  

 

 

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

masfay@163.com

微信:teaey_

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics