Originally created by: promoscow
I using notnoop library to send push-messages to Apple devices.
compile group: 'com.notnoop.apns', name: 'apns', version: '1.0.0.Beta6'
I trying to run code below:
ApnsService service =
APNS.newService()
.withCert("./src/main/resources/data/prod.p12", "*** (скрыт)")
.withAppleDestination(true)
.build();
service.start();
String payload = APNS.newPayload().alertBody(dto.getContent()).alertTitle(dto.getTitle()).build();
List<ApnsNotification> results = Arrays.stream(dto.getPushIds())
.map(t -> service.push(Utilities.encodeHex(t.getBytes()), payload))
.collect(Collectors.toList());
Map<String, Date> inactiveDevices = service.getInactiveDevices();
service.stop();
I receive an answer (field results):
Message(Id=1;
Token=666F4474425256677046383A415041393162467069526B36755A653768436A684970376F553539756454324F434D4774535A49556E6A5F53397070476474647441446A437A677142304268376B7739334E68626770756F2D7962674F4D6E415A736243636D4153353541517969494D4F304B5132793178644367616638774E4A4375366D5763526C676E594D2D6E435A3358436750455246;
Payload={"aps":{"alert":{"body":"Тестовое
сообщение.","title":"Уведомление от нашей компании."}}})Message(Id=2;
Token=65725A6A674A41626241553A415041393162466C337345366E36665156676B336949374131567945585757556F6946396868744D7336673132504D476B664B715945456C5F655344796176496F5A5442667A785142306E58723346516E45654A4759356A583636305244586F527246773957762D577267676D314B6F66774F51354269585479734A42587571737433526F38674F306C555F;
Payload={"aps":{"alert":{"body":"Тестовое
сообщение.","title":"Уведомление от нашей компании."}}})
As we see, all is okay, looks like messages has been sent to devices. But as a fact they not appears on devices.
inactiveDevices.size() = 0