package net;
import .annelKeyPair;
import ..BaiduChannelClient;
..hannelClientException;
import .erverException;
impo.bai.PushBroadcastMessageRequest;
..roadcastMessageResponse;
impor.baid.PushUnicastMessageRequest;
imp.baastMessageResponse;
...YunLogEvent;
import .andler;
public class TestPushMessage {
/**
* 测试推送
*/
public static void main(String[] args) {
String string = "{\"title\":\"你有新消息\",\"description\":\"今天下午全体员工发奖金\","
+ "\"notification_builder_id\":0,\"notification_basic_style\":2,\"custom_content\": {\"id\":\"485446\"},\"open_type\":\"2\"}";
//String string ="hello";
//int status = pushBroadcastMessage(string,3,1);
int status = pushOnlyPleploMessage(string,3,1);
System.ln(status);
}
/**
* 初始化百度推送
*/
private static BaiduChannelClient initPushClient()
{
//这两个key自己申请
String apiKey = "自己申请的apikey";
String secretKey = "自己申请的secretKey";
// 1. 设置developer平台的ApiKey/SecretKey
ChannelKeyPair pair = new ChannelKeyPair(apiKey
百度云推送java端 来自淘豆网m.daumloan.com转载请标明出处.