언어 설정

Menu
Sites
Language
Failed to findMessages in messaging API

I have a filter:

CompositeFilter
  1. filters: Array[3]
    1. 0: AttributeFilter
      1. attributeName: "folderId"
      2. matchFlag: "EXACTLY"
      3. matchValue: "10"
      4. __proto__: CallbackObject
    2. 1: AttributeFilter
      1. attributeName: "folderId"
      2. matchFlag: "EXACTLY"
      3. matchValue: "20"
      4. __proto__: CallbackObject
    3. 2: AttributeFilter
      1. attributeName: "folderId"
      2. matchFlag: "EXACTLY"
      3. matchValue: "22"
      4. __proto__: CallbackObject
    4. length: 3
    5. __proto__: Array[0]
  2. type: "UNION"
  3. __proto__: CallbackObject

 

Trying to get messages:

service.messageStorage.findMessages( f, function(m) { console.dir(m); }, function(e) { console.dir(e); });

get the following error:

WebAPIError
  1. code: 0
  2. message: "Argument is invalid"
  3. name: "InvalidValuesError"
  4. type: "InvalidValuesError"
  5. __proto__: CallbackObject

Which argument is invalid?

 

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

1 댓글
konduri sai swathi

Hi,

Try the below code :

 

tizen.messaging.getMessageServices("messaging.sms", serviceListCB, errorCallback);
    var service=null;
	function serviceListCB(service) {
		console.log("---------------------------------------------") ;
		if (service.length > 0) {
			console.log("in serviceList"+service.length);
			var firstfilter = new tizen.AttributeFilter("to", "CONTAINS", "2593");
			var secondfilter =  new tizen.AttributeFilter('isRead', 'EXACTLY', true);
			var filter = new tizen.CompositeFilter("UNION", [firstfilter, secondfilter]);
			service[0].messageStorage.findMessages(filter,messageQueryCallback);
		}
		else
			console.log("--------");
	}

	function errorCallback(error) {
		console.log("Cannot load message body" + error.message);
	}
	function messageQueryCallback(messages) {
		console.log("no. of messages-----"+messages.length);

		for (var i=0; i<messages.length; i++) {
			var message = messages[i];
			console.log("message id----"+messages[i].id);
			if (message.body.loaded && message.folderId==1) 
			{
				console.log("Message Body is ----- "+message.body.plainBody);
				console.log("Message is From ------- "+ message.from);
				console.log("Is Message Read? ------- "+message.isRead);
				console.log("Message Type is ----- "+message.type);
				console.log("Message Time ------ "+message.timestamp);
				if(!message.isRead){
					console.log("isRead IF----");
				}
			}
		}
	}

Also add "messaging.read" privilege in config.xml -> privileges tab