使用Titanium构建跨平台应用中的推送通知功能
1. 推送通知概述
推送通知允许应用程序与设备之间发送和接收消息,即使应用程序不在前台运行,设备也能接收消息。iOS和Android操作系统都支持此功能,但实现方式有所不同。iOS应用通过Apple Push Notifications (APN) 服务接收通知,而Android应用则通过Google Cloud Messaging (GCM) 服务接收推送通知。
2. 开发平台上的推送通知设置
- Apple推送通知配置
- 需要一个已配置为支持推送通知服务的App ID,以及一个要添加到推送通知服务器的SSL证书和私钥。
- Appcelerator Cloud Services App Dashboard将提供输入私钥信息的界面。
- 设置App ID和获取SSL证书及私钥的详细步骤可参考Appcelerator文档: http://docs.appcelerator.com/cloud/latest/#!/guide/ios-section-push-notification
- Google推送通知配置
- 使用Google Cloud Messaging需要一