阿里云推送
This commit is contained in:
@@ -45,11 +45,11 @@ public class AliyunPushApiTest {
|
||||
pushRequest.setAcceptFormat(FormatType.JSON);
|
||||
//根据Target来设定,多个值使用逗号分隔
|
||||
//此处应该查询出用户所对应的deviceId ★★★★★
|
||||
pushRequest.setTargetValue("c17c0590e8254b6b977b8fd7706fa8c2");
|
||||
pushRequest.setTargetValue("bfde2078565a434aa6636419347fcd33,39a5f06b94324eef87e5665653b42367");
|
||||
//推送类型
|
||||
pushRequest.setPushType("NOTICE");
|
||||
//推送设备类型
|
||||
pushRequest.setDeviceType("ANDROID");
|
||||
pushRequest.setDeviceType("ALL");
|
||||
// 消息的标题
|
||||
pushRequest.setTitle("温度报警");
|
||||
// 消息的内容
|
||||
@@ -59,10 +59,10 @@ public class AliyunPushApiTest {
|
||||
pushRequest.setAndroidNotifyType("BOTH");//通知的提醒方式 "VIBRATE" : 震动 "SOUND" : 声音 "BOTH" : 声音和震动 NONE : 静音
|
||||
pushRequest.setAndroidOpenType("APPLICATION"); //点击通知后动作 "APPLICATION" : 打开应用 "ACTIVITY" : 打开AndroidActivity "URL" : 打开URL "NONE" : 无跳转
|
||||
// 指定notificaitonchannel id
|
||||
pushRequest.setAndroidNotificationChannel("1");
|
||||
// pushRequest.setAndroidNotificationChannel("1");
|
||||
try {
|
||||
PushResponse response = client.getAcsResponse(pushRequest);
|
||||
log.info(response);
|
||||
log.info(response.getMessageId());
|
||||
} catch (ClientException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user