Blackberry 黑莓-从应用程序管理电话会议?
如何从应用程序创建电话会议?我们必须:Blackberry 黑莓-从应用程序管理电话会议?,blackberry,phone-call,conference,Blackberry,Phone Call,Conference,如何从应用程序创建电话会议?我们必须: 开始通话 挂断电话 开始新通话 参加会议 要启动调用,请参阅 没有可保存和加入的api,但我们可以使用此技术 要使应用程序屏幕回到前台,我们可以使用 完整代码: class Scr extends MainScreen implements PhoneListener { private static final String STR_MODULE_NAME = "SOConferenceCall"; EditField mPhone
- 开始通话
- 挂断电话
- 开始新通话
- 参加会议
没有可保存和加入的api,但我们可以使用此技术
要使应用程序屏幕回到前台,我们可以使用 完整代码:
class Scr extends MainScreen implements PhoneListener {
private static final String STR_MODULE_NAME = "SOConferenceCall";
EditField mPhoneNumber = new EditField("phone number: ", "12345");
boolean mConnected = false;
Vector mPhoneCalls = new Vector();
public Scr() {
Phone.addPhoneListener(this);
add(mPhoneNumber);
}
protected void makeMenu(Menu menu, int instance) {
super.makeMenu(menu, instance);
if (isCalling()) {
menu.add(new MenuItem("add to conference", 0, 0) {
public void run() {
holdActiveCall();
makeCall(mPhoneNumber.getText());
}
});
} else {
menu.add(new MenuItem("call", 0, 0) {
public void run() {
makeCall(mPhoneNumber.getText());
}
});
}
}
private void holdActiveCall() {
runMenuItem("Hold");
}
private void joinCalls() {
runMenuItem("Join Conference");
}
private void makeCall(String number) {
PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL,
number);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
}
private void runMenuItem(String menuItemText) {
Screen screen = Ui.getUiEngine().getActiveScreen();
Menu menu = screen.getMenu(0);
for (int i = 0, cnt = menu.getSize(); i < cnt; i++)
if (menu.getItem(i).toString().equalsIgnoreCase(menuItemText))
menu.getItem(i).run();
}
protected int switchToForeground() {
int id = -1;
ApplicationManager appMan
= ApplicationManager.getApplicationManager();
ApplicationDescriptor appDes[]
= appMan.getVisibleApplications();
for (int i = 0; i < appDes.length; i++) {
Sreing name = appDes[i].getModuleName();
if (name.equalsIgnoreCase(STR_MODULE_NAME)) {
id = appMan.getProcessId(appDes[i]);
appMan.requestForeground(id);
// give a time to foreground application
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
}
}
return id;
}
private boolean isCalling() {
return mConnected;
}
public void callAdded(int callId) {
switchToForeground();
}
public void callAnswered(int callId) {
switchToForeground();
}
public void callConferenceCallEstablished(int callId) {
switchToForeground();
}
public void callConnected(int callId) {
if (mPhoneCalls.size() == 0)
mConnected = true;
else
joinCalls();
mPhoneCalls.addElement(Phone.getCall(callId));
switchToForeground();
}
public void callDirectConnectConnected(int callId) {
switchToForeground();
}
public void callDirectConnectDisconnected(int callId) {
switchToForeground();
}
public void callDisconnected(int callId) {
mPhoneCalls.removeElement(Phone.getCall(callId));
if (mPhoneCalls.size() == 0)
mConnected = false;
switchToForeground();
}
public void callEndedByUser(int callId) {
switchToForeground();
}
public void callFailed(int callId, int reason) {
switchToForeground();
}
public void callHeld(int callId) {
switchToForeground();
}
public void callIncoming(int callId) {
switchToForeground();
}
public void callInitiated(int callid) {
switchToForeground();
}
public void callRemoved(int callId) {
switchToForeground();
}
public void callResumed(int callId) {
switchToForeground();
}
public void callWaiting(int callid) {
switchToForeground();
}
public void conferenceCallDisconnected(int callId) {
switchToForeground();
}
}
类Scr扩展主屏幕实现PhoneListener{
私有静态最终字符串STR_MODULE_NAME=“SOConferenceCall”;
EditField mPhoneNumber=新的EditField(“电话号码:”,“12345”);
布尔值mConnected=false;
Vector mPhoneCalls=新向量();
公共Scr(){
addPhoneListener(this);
添加(mPhoneNumber);
}
受保护的void makeMenu(菜单菜单,int实例){
makeMenu(菜单,实例);
if(isCalling()){
添加(新菜单项(“添加到会议”,0,0){
公开募捐{
holdActiveCall();
makeCall(mPhoneNumber.getText());
}
});
}否则{
添加(新菜单项(“调用”,0,0){
公开募捐{
makeCall(mPhoneNumber.getText());
}
});
}
}
私有void holdActiveCall(){
runMenuItem(“持有”);
}
私有调用(){
runMenuItem(“加入会议”);
}
私有void makeCall(字符串编号){
PhoneArguments调用=新的PhoneArguments(PhoneArguments.ARG_调用,
数量);
Invoke.invokeApplication(Invoke.APP\u TYPE\u PHONE,call);
}
私有void runMenuItem(字符串menuItemText){
Screen-Screen=Ui.getUiEngine().getActiveScreen();
菜单菜单=屏幕。获取菜单(0);
对于(inti=0,cnt=menu.getSize();i
让我建议超级用户(SO的姐妹站点)作为这个问题的更好论坛: