×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    11

    Unhappy Problem on Listening for incoming SMS

    Hi guys...

    I have a problem when I catch the incoming SMS, I using the following code for this operation

    Code:
    var criteria = { Type : "NewMessage" };
    var ret = so.IMessaging.RegisterNotification(criteria, onMessageReceived);
    
    function onMessageReceived( transId, eventCode, result ){
      alert("Message Received: \n" + JSON.stringify(result )  );
    };
    and this display the result object with all properties, then i use the senject property for print or save the SMS text content but only get the 65 firsts characteres

    I try run this on the Emulator and contain a property Subject whit "new message" and BodyText property with "My hovercraft is full of eels!" but in device the Subject property conatain the message text, only 65 first chars, and BodyText property is "undefined"

    Please help me to show full message text no only 65 chars that get the Subject property

  2. #2
    Nokia Developer Moderator
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Problem on Listening for incoming SMS

    Hi,

    You can get rest of the message by using the newly received message id as a criteria for getList

    Code:
    function onMessageReceived( transId, eventCode, result ){
    	  		  
    	 messaging_getMessage(result.ReturnValue.MessageId);
    	  
    };
    
    function messaging_getMessage(msgId) {
        var criteria = {
            Type: "Inbox",
            Filter: {            
                MessageId:msgId 
            }
        }
        try {
            // Get list of messages
            var result = messaging_serviceObj.IMessaging.GetList(criteria);
            if (result.ErrorCode != 0) {
                alert("Error in getting messages: " + result.ErrorMessage);
                return;
            }
        } catch (ex) {
            alert("Error in getting messages: " + ex);
            return;
        }
        
        var item;
    	
        while ((item = result.ReturnValue.getNext()) != undefined) {
            var messageId = item.MessageId;
            var sender = item.Sender;
            var time = item.Time;
            var subject = item.Subject;
    		var body = item.BodyText;		
    		alert(messageId+"\n"+sender+"\n"+time+"\n"+subject+"\n"+body);
    	
        }
    }
    -Ilkka

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    11

    Re: Problem on Listening for incoming SMS

    hey isalento..

    this code is working...

    thanks

Similar Threads

  1. a problem for listening for the coming of SMS
    By LaineGates in forum Symbian C++
    Replies: 2
    Last Post: 2009-08-01, 14:27
  2. Listening to an incoming SMS
    By Archana Muralidhar in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-29, 06:31
  3. Listening Incoming SMS
    By earendil in forum Symbian C++
    Replies: 6
    Last Post: 2007-06-06, 18:22
  4. Replies: 1
    Last Post: 2005-12-01, 23:57
  5. Listening for Outgoing and Incoming SMS messages
    By junsworth in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-06-20, 10:37

Posting Permissions

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