언어 설정

Menu
Sites
Language
How to get messages from different services?

Using Messaging API it is possible to get a list of services using getMessageServices and using MessageStorage find messages for a particular service.

How is it possible to get messages from all services as one sorted and ordered list?

 

 

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

Responses

1 댓글
Raghavendra Reddy Shiva

You may be able to retrieve all messages from all services, but don't find any direct way to get these messages sorted or ordered from the messaging API.

Not sure if its a works for you, but just a suggestion to try. You can create a list with all the message details retrieved as list and sort it Or might use the libraries like List.js to sort the list for you.

Anyways for retrieving messages from all services, you have to retrieve the available services using the "getMessageServices" method, and then just 
loop the services to retrieve all messages from all the services(of a particular service type). 

 // Define the success body loaded callback.
 function successCallback(message) {
   console.log ("Message body: " + message.subject + "from: " + message.from + "loaded.");
 }
 // Define error callback.
 function errorCallback(error) {
   console.log("Cannot load message body" + error.message);
 }

 function messageQueryCallback(messages) {
   for (var i = 0; i < messages.length; i++) {
     var message = messages[i];
     if (!message.body.loaded) {
        service.loadMessageBody(message, successCallback, errorCallback);
     }
   }
 }
 
// Define the success callback.
 function serviceListCB(services) {
   if (services.length > 0) {
      for (var i=0; i < services.length; i++) { 
         
          // find message from all services
          services[i].messageStorage.findMessages(new tizen.AttributeFilter("from", "CONTAINS", "");, messageQueryCallback);
      }
   }
 }
 tizen.messaging.getMessageServices("messaging.email", serviceListCB);