用户安装了及时聊天软件A好友向他发送了信息。但是他并没有打开软件。这个时候怎么实现提醒用户。把好友的信息推送给他呢?
解决方案 »
- 在iphone中隐藏虚拟键盘的实现
- 那位大深帮忙解决一下iphong编程时出错了,这是哪儿出错了怎么解决 啊
- 如何让虚拟键盘横屏显示!
- EXC_BAD_INSTRUCTION 错误,请大家帮忙!
- iphone6.1.3的shsh 谁有啊 请发给我 谢谢 [email protected]
- IOS Local notification定时向后台发送数据
- 向UIScrollView中添加button,滑动有点卡顿,何解?
- 10 分钟为 App 加入实时通讯功能
- xcode6 如何制作ipa越狱包?
- 有没有这样的图片控件?
- 大神帮我看看这段代码怎么改,有点看不懂
- 横屏状态下载应用内部显示AppStore,显示不出是什么原因?竖屏状态下可以显示!
以java为服务器,Ios为客户端,服务器执行一下代码会调用苹果服务器向Ios设备推送一条消息,ios就会像微信一样出现消息提醒。//定义消息模式
PayLoad payLoad = new PayLoad();
//如果是文本才解密
String msgContent = "接受到消息";
payLoad.addAlert(msgContent);
// payLoad.addBadge(1);//消息推送标记数,小红圈中显示的数字。
payLoad.addBadge(badgenum);//消息推送标记数,小红圈中显示的数字。
payLoad.addSound("default");
//注册deviceToken
PushNotificationManager pushManager = PushNotificationManager.getInstance();
try {
pushManager.removeDevice("iPhone");
} catch (Exception ex) {
}
pushManager.addDevice("iPhone", deviceToken);
//连接APNS
String host = "gateway.sandbox.push.apple.com"; //本地
// String host = "gateway.push.apple.com"; //192.168.1.161
int port = 2195;
String certificatePath = ServiceFactory.getSettingService().getSettingValueByName("certificatepath");//前面生成的用于JAVA后台连接APNS服务的*.p12文件位置
String certificatePassword = ServiceFactory.getSettingService().getSettingValueByName("certificatepassowrd");//p12文件密码。
pushManager.initializeConnection(host, port, certificatePath, certificatePassword, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
//发送推送
Device client = pushManager.getDevice("iPhone");
log.info("推送消息: " + client.getToken() + "\n" + payLoad.toString() + " ");
pushManager.sendNotification(client, payLoad);
//停止连接APNS
pushManager.stopConnection();
//删除deviceToken
pushManager.removeDevice("iPhone");