Skip to content

Realease_1.1.1

Compare
Choose a tag to compare
@teaey teaey released this 10 Oct 14:34
· 14 commits to 1.1.0 since this release
  • 提升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.1</version>
</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();