Search in sources :

Example 1 with JiguangPush

use of cn.cerc.jdb.jiguang.JiguangPush in project summer-mis by cn-cerc.

the class JPushRecord method send.

public void send(IHandle handle) {
    LocalService svr = new LocalService(handle, "SvrUserLogin.getMachInfo");
    if (!svr.exec("CorpNo_", corpNo, "UserCode_", userCode)) {
        throw new RuntimeException(svr.getMessage());
    }
    // 设置极光推送平台
    JiguangPush push = new JiguangPush(handle);
    push.setMessage(alert);
    push.setMsgId("" + msgId);
    push.setTitle(title);
    // 将消息推送到极光平台
    DataSet dataOut = svr.getDataOut();
    while (dataOut.fetch()) {
        String machineCode = dataOut.getString("MachineCode_");
        int machineType = dataOut.getInt("MachineType_");
        switch(machineType) {
            case 6:
                push.send(ClientType.IOS, machineCode);
                break;
            case 7:
                // 过滤掉没有注册IMEI码的移动设备
                if (!"n_null".equals(machineCode) && !"n_000000000000000".equals(machineCode)) {
                    push.send(ClientType.Android, machineCode);
                }
                break;
            default:
                break;
        }
    }
}
Also used : DataSet(cn.cerc.jdb.core.DataSet) JiguangPush(cn.cerc.jdb.jiguang.JiguangPush) LocalService(cn.cerc.jbean.client.LocalService)

Aggregations

LocalService (cn.cerc.jbean.client.LocalService)1 DataSet (cn.cerc.jdb.core.DataSet)1 JiguangPush (cn.cerc.jdb.jiguang.JiguangPush)1