⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smspush.java

📁 SI push implementation sample via SMS
💻 JAVA
字号:
  public String getSMSPush(String url, String subject) {

    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");

    String time = format.format(Calendar.getInstance().getTime());
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE,90);
    String expireTime = format.format(cal.getTime());

//
    Object[] arguments = {
        url,
  //      time,
  //      expireTime,
        subject
    };

    //form WBXML formatted SI
    byte[] msg = {0x02,0x05, 0x6A, 0, 0x45, (byte)0xC6, 0x0C, 0x03, '{','0','}',0,1,3,'{','1','}',0,1,1};    
    String temp = "";
    try{
      temp = new String(msg, "ISO8859-1");
    }catch(Exception e) {};
      String pushMessage = MessageFormat.format(temp,arguments);


    int len = pushMessage.length();
    //0--transaction ID
    //6--PDU type(6=push)
    //3-- length(include content type,charset,utf-8)
    //0xae--content type: application/vnd.wap.sic
    //0x81--charset
    //0xea--UTF-8
    //0xaf--x-wap-application-id
    //0x82--wap brouser
    byte[] pdu = {(byte)0, 0x06, 0x06,0x03,(byte)0xae,(byte)0x81,(byte)0xEA,(byte)0xaf,(byte)0x82};  
//      byte[] pdu = {(byte)0x25, 0x06, 0x03,(byte)0xae,(byte)0xaf,(byte)0x1};
    
    byte[] udh = {0x06,0x05,0x04,0x0B,(byte)0x84,(byte)0x23,(byte)0xF0};
    try{
      String strPDU = new String(pdu, "ISO8859-1");
      String strUDH = new String(udh, "ISO8859-1");
      return strUDH + strPDU + pushMessage;
    }catch(Exception e) {}
    return "";
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -