×

Discussion Board

Results 1 to 3 of 3

Thread: Push SMS

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    3

    Push SMS

    Hi everybody, has anybody an idea how to recognize an incoming push SMS?

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Tampere / Finland
    Posts
    1,839
    Hello!

    If you are talking about AT command interface to receive WAP PUSH message, no can do.

    If you are using Java or C++ to process the incoming message, please post your question to appropriate forum.

    Teemu / Forum Nokia

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    9

    Wap Push VB Code

    SMS PUSH 源代码


    private static String getSMSPush(String url, String subject, String startTime,
    String endTime) {
    String pushString = "";
    String body = "";
    body += "02";
    body += "05"; //-//WAPFORUM//DTD SI 1.0//EN
    body += "6A"; //UTF-8
    body += "00"; //字符串结束
    body += "45"; //<si>
    body += "C6"; //<indication
    body += "08"; //<action=signal-high>
    body += "0C"; //href="http://
    body += "03"; //字符串开始
    body += byteArrayToHexString(url.getBytes()); //实际地址
    body += "00"; //字符串结束
    body += "0A"; //created=
    body += "C3"; //'时间
    body += "07"; //时间字节数
    body += startTime; //YYYYMMDDHHMMSS
    body += "10"; //si_expires=
    body += "C3"; //时间
    body += "07"; //时间字节数
    body += endTime; //YYYYMMDDHHMMSS
    body += "01"; //>
    body += "03"; //字符串开始
    try {
    body += byteArrayToHexString(subject.getBytes("UTF-8")); //显示给用户的内容,用utf-8编码。utf-8编码,英文字符直接用ascii码;中文如果unicode是(二进制)
    }
    catch (Exception ex) {
    }
    body += "00"; //字符串结束
    body += "01"; //</indication>"
    body += "01"; //'</si>
    int length = body.length();
    String pud = "";
    pud += "81"; //transaction id (connectionless WSP)
    pud += "06"; //'pdu type (06=push)
    pud += "06"; //Headers len
    pud += "03";
    pud += "AE";
    pud += "81";
    pud += "EA"; //content type: application/vnd.wap.sic; charset=utf-8
    pud += "8D"; //content-length
    pud += Integer.toHexString(length).toUpperCase();
    String udh = "";
    udh += "06"; //User Data Header Length (6 bytes)
    udh += "05"; //UDH Item Element id (Port Numbers)
    udh += "04"; //UDH IE length (4 bytes)
    udh += "0B";
    udh += "84"; //destination port number
    udh += "23";
    udh += "F0"; //origin port number
    pushString = udh + pud + body;
    return pushString;
    }

    public static String byteArrayToHexString(byte b[]) {
    String result = "";
    for (int i = 0; i < b.length; i++)
    result = result + byteToHexString(b[i]);
    return result;
    }

    public static String byteToString(byte b[]) {
    String result = "";
    for (int i = 0; i < b.length; i++) {
    result = result + b[i];
    }
    return result;
    }

    public static String byteToHexString(byte b) {
    int n = b;
    if (n < 0)
    n = 256 + n;
    int d1 = n / 16;
    int d2 = n % 16;
    return HexCode[d1] + HexCode[d2];
    }

    private static String HexCode[] = {
    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "A", "B", "C", "D", "E", "F"
    };

    private static String getUTFString(final String gbString) {
    if (gbString == null)
    return "";
    char[] utfBytes = gbString.toCharArray();
    String unicodeBytes = "";
    for (int byteIndex = 0; byteIndex < utfBytes.length; byteIndex++) {
    String hexB = "";
    if (utfBytes[byteIndex] < '!') {
    hexB = Integer.toHexString(utfBytes[byteIndex]);
    if (hexB.length() <= 2) {
    hexB = "00" + hexB;
    }
    unicodeBytes = unicodeBytes + "&#x" + hexB + ";";
    }
    else {
    unicodeBytes += utfBytes[byteIndex];
    }
    }
    return unicodeBytes;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •