下载 blackberry-WebWorks-Community-APIs
https://github.com/blackberry/WebWorks-Community-APIs
电脑上已经安装了BlackBerry WebWorks SDK for smartphone
安装路径,比如C:\RIM\BlackBerry WebWorks SDK 2.3.1.5
在其子目录ext下,创建子目录webworks.message.email
解压缩blackberry-WebWorks-Community-APIs zip文件, 拷贝其中的\Smartphone\EmailListener下面所有文件到
BlackBerry WebWorks SDK 2.3.1.5\ext\webworks.message.emailBlackBerry Webworks应用的config.xml应包括
<feature id="webworks.message.email" />
<feature id="blackberry.message" />
<feature id="blackberry.identity" />
<feature id="blackberry.find" />
message的常用字段如下,更多字段见BlackBerry WebWorks SDK 2.3.1.5\ext\blackberry.messaging\blackberry\messaging\message\MessageObject.java源代码
message.from
message.toRecipients
message.subject
message.body
例子代码:
<html> <head> <meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" /> <script type="text/javascript" > webworks.message.email.startListening("", displayMessage); function displayMessage(servicename, msgObject){ alert("Message recevied from listener for service: " + servicename); document.getElementById("main_screen_container").innerHTML += "<br /> Message recevied from listener for service: " + servicename; document.getElementById("main_screen_container").innerHTML += "<br />msgObject.from = " + msgObject.from; document.getElementById("main_screen_container").innerHTML += "<br />msgObject.subject = " + msgObject.subject; //check out the API for more Message Object properties there are tons } </script> </head> <body > <div id="main_screen_container"></div> </body> </html>
s