开源地址:https://github.com/teaey/apns4j
【最好用的】Java APNS开源库apns4j-1.1.0发布
-
提升API的易用性,移除繁杂的初始化逻辑,入口集中到cn.teaey.apns4j.Apns4j
-
提供简单的异步服务
-
增加ios7以上静默推送设置(content-available)
-
sendAndFlush -> send 或许开始就是个错误!
-
减少builder模式,能够更好的与spring等框架做集成
-
groupId调整:cn.teaey.apns4j
<dependency> <groupId>cn.teaey.apns4j</groupId> <artifactId>apns4j</artifactId> <version>1.1.0</version> </dependency> //Step 1 ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder() .keyStoreMeta("${path to your keystore}") .keyStormPwd("${keystore password}") .build(); //Setp 2 ApnsChannel apnsChannel = apnsChannelFactory.newChannel(); //Step 3 create & init notify payload ApnsPayload apnsPayload = Apns4j.newPayload() .alertActionLocKey("FixMe") .alertTitle("Title") .alertBody("Pushed by apns4j") .sound("default"); //Step 4 send via channel apnsChannel.send(TestConts.deviceToken, apnsPayload); //Step 5 in the end, apnsChannel can be Recycle and Reuse apnsChannel.close();
有疑问请留言,或者联系本人:
masfay@me.com
github:http://github.com/teaey
开源地址:https://github.com/teaey/apns4j