|
@ -18,9 +18,12 @@ import com.getui.push.v2.sdk.dto.req.message.android.Ups;
|
|
|
import com.getui.push.v2.sdk.dto.req.message.ios.Alert;
|
|
|
import com.getui.push.v2.sdk.dto.req.message.ios.Aps;
|
|
|
import com.getui.push.v2.sdk.dto.req.message.ios.IosDTO;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@ -58,6 +61,40 @@ public class GetuiUtil {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
/* String url = "http://sdk.open.api.igexin.com/apiex.htm";
|
|
|
IGtPush push = new IGtPush(url, AppKey, MasterSecret);
|
|
|
|
|
|
TransmissionTemplate t = new TransmissionTemplate();
|
|
|
t.setAppId(AppID);
|
|
|
t.setAppkey(AppKey);
|
|
|
t.setTransmissionContent("{title:\"标题\",content:\"内容\",payload:\"自定义数据\"}");
|
|
|
t.setTransmissionType(1);
|
|
|
|
|
|
// 定义"点击链接打开通知模板",并设置标题、内容、链接
|
|
|
// LinkTemplate template = new LinkTemplate();
|
|
|
// template.setAppId(appId);
|
|
|
// template.setAppkey(appKey);
|
|
|
// template.setTitle("你好你好");
|
|
|
// template.setText("哦,好吧");
|
|
|
// template.setLogoUrl("");
|
|
|
// template.setUrl("http://getui.com");
|
|
|
|
|
|
List<String> appIds = new ArrayList<String>();
|
|
|
appIds.add(AppID);
|
|
|
|
|
|
// 定义"AppMessage"类型消息对象,设置消息内容模板、发送的目标App列表、是否支持离线发送、以及离线消息有效期(单位毫秒)
|
|
|
SingleMessage message = new SingleMessage();
|
|
|
message.setData(t);
|
|
|
message.setOffline(true);
|
|
|
message.setOfflineExpireTime(1000 * 600);
|
|
|
|
|
|
// 指定向哪儿推
|
|
|
Target target = new Target();
|
|
|
target.setAppId(AppID);
|
|
|
target.setClientId("d2fee750dcdf7a2567444b1d4f629305");
|
|
|
|
|
|
IPushResult ret = push.pushMessageToSingle(message, target);
|
|
|
System.out.println(ret.getResponse().toString());*/
|
|
|
// JSONObject jsonObject = new JSONObject();
|
|
|
// jsonObject.put("title","title");
|
|
|
// jsonObject.put("body","body");
|
|
@ -73,8 +110,8 @@ public class GetuiUtil {
|
|
|
String cid = "d2fee750dcdf7a2567444b1d4f629305";
|
|
|
String title = "ios11:49标题";
|
|
|
String body = "安卓离线展示的内容";
|
|
|
// String url = "https://www.baidu.com/";
|
|
|
String url = "/archives/index";
|
|
|
String url = "https://www.baidu.com/";
|
|
|
// String url = "/archives/index";
|
|
|
JSONObject payload = new JSONObject();
|
|
|
payload.put("title",title);
|
|
|
payload.put("body",body);
|
|
@ -88,7 +125,7 @@ public class GetuiUtil {
|
|
|
json.put("platform",cloudCareDoctor);
|
|
|
json.put("payload",payload.toString());
|
|
|
|
|
|
push2(cid,1,json);
|
|
|
push2(cid,2,json);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -152,6 +189,7 @@ public class GetuiUtil {
|
|
|
IosDTO iosDTO = new IosDTO();
|
|
|
iosDTO.setAps(aps);
|
|
|
iosDTO.setType("notify");
|
|
|
iosDTO.setPayload(json.getString("payload"));
|
|
|
pushChannel.setIos(iosDTO);
|
|
|
}
|
|
|
|