【最好用的】Java APNS开源库apns4j-1.1.1发布

阅读更多

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

【最好用的】Java APNS开源库apns4j-1.1.1发布

  • 提升API的易用性,移除繁杂的初始化逻辑,入口集中到cn.teaey.apns4j.Apns4j

  • 提供简单的异步服务

  • 增加ios7以上静默推送设置(content-available)

  • sendAndFlush -> send 或许开始就是个错误!

  • 减少builder模式,能够更好的与spring等框架做集成

  • groupId调整:cn.teaey.apns4j

<dependency>
    <groupId>cn.teaey.apns4jgroupId>
    <artifactId>apns4jartifactId>
    <version>1.1.1version>
dependency>
//Step 1
ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder()
.keyStoreMeta("${path to your keystore}")
.keyStorePwd("${keystore password}")
.build();

//Setp 2
ApnsChannel apnsChannel = apnsChannelFactory.newChannel();

//Step 3 create & init notify payload
ApnsPayload apnsPayload = Apns4j.newPayload()
        .alertTitle("Title")
        .alertBody("Pushed by apns4j")
        .sound("default");

//Step 4 send via channel
apnsChannel.send("${target device token}", apnsPayload);

//Step 5 in the end, apnsChannel can be Recycle and Reuse 
apnsChannel.close();

from iteye

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

联系作者: 
[email protected] 
github:http://github.com/teaey

你可能感兴趣的:(javaapns,apns4j,apns)