Code Monkey home page Code Monkey logo

apns4j's Issues

发送消息后,没有报错,但是手机始终是收不到

Java端发送消息后,没有报错,但是手机始终是收不到:
我的代码如下:
ApnsChannelFactory apnsChannelFactory = Apns4j.newChannelFactoryBuilder()
.keyStoreMeta(certPath)
.keyStorePwd("Rj1234567890")
.keyStoreType(KeyStoreType.PKCS12)
.apnsGateway(ApnsGateway.PRODUCTION)
.build();
//Setp 2
ApnsChannel apnsChannel = apnsChannelFactory.newChannel();
//Step 3 create & init notify payload
ApnsPayload apnsPayload = Apns4j.newPayload()
.alertTitle("Up Task消息")
.alertBody(message)
.sound("default");
//Step 4 send via channel
apnsChannel.send(token.getApnsToken().replace("<", "").replace(" ", "").replace(">", ""), apnsPayload);
//Step 5 in the end, apnsChannel can be Recycle and Reuse
apnsChannel.close();
log.debug("sendApnsMessage end");

1.1.4版本有重复发送的问题

在ApnsChannel类中_detectSocket启动的线程由于close方法关闭不到位检测不到关闭信号,导致该线程运行时长超出预期,错误的又把payloadCache缓存的消息再次发送,从而导致了消息的重复发送。

目前测试默认情况下大约2小时,消息会重发。
_detectSocket方法检测不到ApnsChannel.this.closed。该线程不停的跑。跑久了会出事。

deviceToken是手机UDID,提示device token bytes must [32] length not [20]

deviceTokenString传入UDID,提示'
Exception in thread "main" cn.teaey.apns4j.protocol.InvalidDeviceTokenException: device token bytes must [32] length not [20]
at cn.teaey.apns4j.ApnsHelper.checkDeviceToken(ApnsHelper.java:107)
at cn.teaey.apns4j.network.ApnsChannel.send(ApnsChannel.java:121)
at cn.teaey.apns4j.network.ApnsChannel.send(ApnsChannel.java:155)
at cn.teaey.apns4j.network.ApnsChannel.send(ApnsChannel.java:179)
at com.stylefeng.guns.rest.modular.push.service.impl.Push.main(Push.java:30)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.