服务器向ios推送消息

//证书路径和证书名
String keystore = "push_pro.p12";
 // 证书密码
String password = "123456";
//设置true为正式服务器,false为开发者地址
boolean production = false;
if(!production){
production = true;
keystore = "dev_push.p12";
}
// 为设备添加发送的Payload数据
List<PayloadPerDevice> list = new ArrayList<PayloadPerDevice>();
PushNotificationPayload payload = new PushNotificationPayload();
 

payload.addAlert("有消息到达,请点击查看详情");

payload.addSound("default");// 声音

payload.addBadge(1);// 图标小红圈的数值

//将要推送的消息和手机唯一标识绑定
PayloadPerDevice pay = new PayloadPerDevice(payload, tokenStr);// 将要推送的消息和手机唯一标识绑定
list.add(pay);
Push.payloads(keystore, password, production, 10, list);

你可能感兴趣的:(服务器向ios推送消息)