手機上網的時候, wml/XHTML 網頁上往往有一些連接,點擊即可調用手機實現撥號和發短信的功能,比較自然的體現了手機應用的特點。 dig了一下。
Wireless Telephony Application Interface (WTAI) 負責定義此項實現, 實際上,早期的j2me 實現類似功能,據說也是調用wap瀏覽器來間接做到的。
WTAI URI基本格式如下
wtai://<library>/<function> (; <parameter>)* [! <result>]
< > Denotes an enumerated operator
[ ] Denotes an optional section
|? Denotes a pair of mutually exclusive options
( )*? Repeat none or multiple items
*( )? Repeat one or multiple items
library? Name that identifies type of library, WTA Public uses library “wp”
function? Function within a library, for example “mc” for function “make call” in “wp” library
parameter Zero or more parameters sent to a function, should be delimited by a semicolon “;”
result? Start of result is denoted by “!”. optional
WTAI 代碼示例
1. 實現click - to- dial 功能
mc: make call
<a href="wtai://wp/mc;5551212">Call 5551212</a>
另外在一些同時支持wml和xhtml mp的手機,比如nokia 系列, 也可以以非標準WTAI URI的方式調用,比如
<a href="tel:+468123456">Call</a>
2.? Add-to-Phonebook?
WMLScript: WTAPhoneBook.write("2", "5554367", "EINSTEIN");
3. Add-to-Speed Dial
<a href="wtai://wp/ap;5551212;My Company”>5551212</a>
4. voice call
wtai://vc/sc; 5554367;1
5. Accept Call
可以接收一個call 入電話,這個還不知道怎么玩,比較有意思。 如果能和后臺語音系統整合
6. read text
可以讀入一個網絡文本,并且保存到手機。 超級短信?這個做廣告的時候會比較實用。
WTAI是一個比較老的規范, 還不支持短信調用。
查了一下,在 xhtml mp中可以用如下格式 發送短信。
<a href="sms:+3581234567">Send SMS to us </a>
ps:實際測試發現, sms只有nokia支持, phonebook,除了nokia,很多手機都只支持加電話,會丟失聯系人信息。