Apple Push Notification Service(APNS)开发指引
来源:互联网 发布:淘宝充值q币没到账 编辑:程序博客网 时间:2024/05/21 15:35
notnoop/java-apns github:https://github.com/notnoop/java-apns
简介
java-apns是服务于APNS服务的java客户端,该库目的是提供一套面对苹果服务器的高扩展性、简单、模块化的接口。
这些接口只需要很少的代码去完成大多数的cases,同时你还可以用永自己的网络链接库或者json库重新配置java-apns库。
Links: Installation
- Javadocs
- Changelog
细节:
- 简单易用,高性能的APNS API
- 支持Apple反馈服务
- 支持增强的Apple Push Notification
- 支持MDM和NewStand Notification
- 方便读取Apple certificates
- 方便扩展&复用
- 容易集成在框架中
- 自定义push负载
- 支持pooling的链接
- 遇错重连
Sample Code
To send a notification, you can do it in two steps:
建立连接
ApnsService service = APNS.newService() .withCert("/path/to/certificate.p12", "MyCertPassword") .withSandboxDestination() .build();
创建&发送消息
String payload = APNS.newPayload().alertBody("Can't be simpler than this!").build();String token = "fedfbcfb....";service.push(token, payload);
通过反馈服务获取不活动的设备列表
Map<String, Date> inactiveDevices = service.getInactiveDevices();for (String deviceToken : inactiveDevices.keySet()) { Date inactiveAsOf = inactiveDevices.get(deviceToken); ...}
自定义发送内容
你可以发送自定义的消息,支持自定义的字段
String payload = APNS.newPayload() .badge(3) .customField("secret", "what do you think?"); .localizedKey("GAME_PLAY_REQUEST_FORMAT") .localizedArguments("Jenna", "Frank") .actionKey("Play").build();service.push(token, payload);
增强的Notification Push Format
String payload = APNS.newPayload() .badge(3) .customField("secret", "what do you think?"); .localizedKey("GAME_PLAY_REQUEST_FORMAT") .localizedArguments("Jenna", "Frank") .actionKey("Play").build(); EnhancedApnsNotification notification = new EnhancedApnsNotification(EnhancedApnsNotification.INCREMENT_ID() /* Next ID */, new Date().getTime() + 60 * 60 /* Expire in one hour */, token /* Device Token */, payload); service.push(notification);
0 0
- Apple Push Notification Service(APNS)开发指引
- Apple Push Notification Service(APNS)开发指引
- APNS - Apple Push Notification Service
- iPhone Apple Push Notification Service (APNS)
- Apple Push Notification Service(APNS)相关
- Push Notification Service (APNs)
- iPhone Apple Push Notification Service (APNS)(全教程)
- Apple Push Notification Service (APNS)原理与实现方案
- iPhone Apple Push Notification Service (APNS)(全教程)
- java libs for apns:apple push notification service
- iPhone Apple Push Notification Service (APNS)(全教程)
- Apple Push Notification Service (APNS)原理与实现方案
- iOS APNS 訊息推播 – Apple Push Notification Service 介紹
- APNS(Apple Push Notification Service)远程推送原理解析
- Apple Push Notification service
- Apple Push Notification service
- Apple Push Notification Service
- APNs Apple Push Notification Services 推送消息
- 创建彩色内存位图
- STL中的set是用什么实现的?为什么不用hash?
- 记忆按钮
- XML和HTML的比较
- 屏幕截图,view,ScrollView截图
- Apple Push Notification Service(APNS)开发指引
- 程序员的回归式进化
- 转换时间——CONVERT (VARCHAR,getdate(),23)
- Spring中Quartz的配置
- Xcode把应用程序打包成ipa
- 使用SecureCRT连接ubuntu
- Android VPN 编程
- Java的序列化
- AOJ-AHU-OJ-661 跨越千山万水只为找到你