Usages of

com.baidu.yun.push.auth.PushKeyPair.PushKeyPair(?, ?)
public static BaiduPushClient getBaiduPushClient() { if (baiduClient == null) { PushKeyPair pair = new PushKeyPair(Contans.BAIDU_PUSH_API_KEY, Contans.BAIDU_PUSH_SECRETKEY); baiduClient = new BaiduPushClient(pair); } return baiduClient; }
@Test public void testBaiduPush() throws PushClientException, PushServerException, IOException { PushKeyPair pair = new PushKeyPair("MPCCC4ORpe6cHbOG7PgUZnNK", "7Gm8Qi6HB2L6y47Ynwc9uZbqpQmWUabm"); BaiduPushClient pushClient = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); PushMsgToSingleDeviceRequest request = new PushMsgToSingleDeviceRequest().addChannelId("4238282200440847692") .addMsgExpires(3600).addMessageType(0) .addMessage(JSONObject.toJSONString("{\"sendTime\": \"sdfgsdfgsdfg\", \"targetId\": 23, \"type\": 6, \"msg\": \"test msg\"}")).addDeviceType(DeviceType.ANDROID.value()); PushMsgToSingleDeviceResponse response = pushClient.pushMsgToSingleDevice(request); //http request long sendTime = response.getSendTime(); System.out.format("baiduMsgPush:msgId:[%s], sendTime:[%s].", response.getMsgId(), sendTime); }
public static void initBaiduPushClient() { PushKeyPair pair = new PushKeyPair(apiKey, secretKey); pushClient = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); pushClient.setChannelLogHandler(new YunLogHandler() { @Override public void onHandle(YunLogEvent event) { System.out.println(event.getMessage()); } }); }
private PushKeyPair pair; // code omitted ... /** * ���������BaiduPushClient */ private void init() { pair = new PushKeyPair(R.baidupush.api_key, R.baidupush.secret_key); client = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); client.setChannelLogHandler(new YunLogHandler() { @Override public void onHandle(YunLogEvent event) { System.out.println(event.getMessage()); } }); }
private BaiduPushClient genPushClient() { PushKeyPair pair = new PushKeyPair(apiKey,secretKey); BaiduPushClient pushClient = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); pushClient.setChannelLogHandler (new YunLogHandler () { public void onHandle (YunLogEvent event) { logger.info(event.getMessage()); } }); return pushClient; }
private PushKeyPair pushKeyPair; // code omitted ... private PushServiceClient() { pushKeyPair = new PushKeyPair(API_KEY, SECRET_KEY); baiduPushClient = new BaiduPushClient(pushKeyPair, PUSH_HOST); baiduPushClient.setChannelLogHandler(new YunLogHandler() { @Override public void onHandle(YunLogEvent event) { System.out.println(event.getMessage()); } }); }
private static PushKeyPair driverPushKeyPair; // code omitted ... private static PushKeyPair getBaiduPushKeyPairForDriverAPP(){ if (driverPushKeyPair == null) driverPushKeyPair=new PushKeyPair(Configuration.getBaiduDriverPushApiKey(), Configuration.getBaiduDriverPushSecretKey()); return driverPushKeyPair; }
private static PushKeyPair getPushKeyPair(Integer deviceType){ PushKeyPair pair = null; if(deviceType==IOS_TYPE){ pair = new PushKeyPair(IOS_API_KEY, IOS_SECRET_KEY); }else if(deviceType==ANDROID_TYPE){ pair = new PushKeyPair(ANDROID_API_KEY, ANDROID_SECRET_KEY); }else{ throw new EmosException("1", "no support type"); } return pair; }
private static PushKeyPair getPushKeyPair(Integer deviceType){ PushKeyPair pair = null; if(deviceType==IOS_TYPE){ pair = new PushKeyPair(IOS_API_KEY, IOS_SECRET_KEY); }else if(deviceType==ANDROID_TYPE){ pair = new PushKeyPair(ANDROID_API_KEY, ANDROID_SECRET_KEY); }else{ throw new MposException("1", "no support type"); } return pair; }
private BaiduPushClient initBaiduClient() { PushKeyPair pair = new PushKeyPair(apiKey, secretKey); BaiduPushClient pushClient = new BaiduPushClient(pair, BaiduPushConstants.CHANNEL_REST_URL); pushClient.setChannelLogHandler(new YunLogHandler() { @Override public void onHandle(YunLogEvent event) { logger.info(event.getMessage()); } }); return pushClient; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes