WebAPI/AppDefinedTeleophony
For B2G, communication applications likes Skype, WhatsApp, LINE, Facebook, Google plus..., etc, will define their owned communication protocols for short/instant messages, voice calling, and contacts. The features of these applications are very similar to telephony, users may like to integrate all of them into one/or several place(s).
For most communication applications, they are comprised by contacts, calling history, messaging, and voice/video calling service. For voice/video call, it is very different from one application to another. So, every application should define their owned user interface to accept and initiate a call. But, for contact, calling history, and messages, they are very similar for applications. By integrating contact, calling history, and messages from all applications, the platform can provide better UX that users can browse and search all information at one place.
Following, this page is about changes of ContactsAPI, calling history, and Messaging API
Contacts API
interface ContactField : nsISupports { attribute DOMString handler; // the application that can handle voice/video calling and messaging. attribute DOMURI status; // an status icon as an indication of presence and alike. attribute DOMString[] type; // for primary/favorite (use:"PREF"), "home", "work", etc. attribute DOMString value; };
|handler| and |status| field are added to ContactField interface. With them, the contact app can invoke the correct APP to initiate a voice/video calling or concall. For most IM now, |status| field can be used to show presence and status of a user.
For handling changing of |status|, the App should listen on ContactsManager::oncontactchange event.
Messaging API
interface Messaging { readonly attribute SmsManager sms; readonly attribute MmsManager mms; MessagingRequest findMessages (MessagingFilter filter, FilterOptions options); MessagingRequest findConversations (DOMString groupBy, MessagingFilter filter, FilterOptions options); MessagingRequest getMessage (DOMString id); MessagingRequest deleteMessage (DOMString id); MessagingRequest deleteConversation (DOMString id); MessagingRequest markMessageRead (DOMString id, boolean value); MessagingRequest markConversationRead (DOMString id, boolean value); MessagingRequest addArrivedMessage(SmsMessage msg); // IM or Telephony Apps can add a new message as a new arrival. };
interface Message { readonly attribute DOMString id; readonly attribute DOMString handler; // the application that can handle the message for replying or sending. readonly attribute DOMString receiver; // the account receiving the message. readonly attribute DOMString sender; readonly attribute Date timestamp; readonly attribute boolean read; };
addArrivedMessage() is added to Messaging to let communication Apps add a message for a new arriving message. |handler| is added to Message to record the application can handle replying the message. |receiver| is the account receiving the message. It is used by the handler to distinguish the user of the service. The message app is not supposed for responding for editing messages. It should wake up the handler of the message for editing. |type| and |serviceID| can be removed and replaced by |handler| and |receiver| while |receiver| are used to distinguish different SIM.
Should we provide a way for synchronization between the database of Messaging API and App's local storage?
Calling history
There is no API for calling history. We need a new API for that. It must have the capability of telling what the App can handle an address/number in the calling history.
Communication Apps
The communication apps are invoked through activities or other IPC mechanism. A communication App should provide following functions.
- initiate a voice/video call to a receiver
- reply an existing message in the database of Messaging API
- send a new message to a given receiver
- show a user in contacts
The communicaton apps are responsible for handling incoming calls and messages. But, they store contacts, messages, and calling history in ContactsAPI, Messaging API, and calling history API.