在BlackBerry上关闭系统对话框 [英] Dismiss a system dialog on BlackBerry
问题描述
我有一个BlackBerry应用程序在后台运行,需要知道系统何时启动未接来电系统对话框,并在没有用户干预的情况下以编程方式关闭它。我可以这样做吗?
I have a BlackBerry app running in the background that needs to know when a "Missed call" system dialog is brought up by the system, and programmatically close it without user intervention. How can I do that?
几乎可以知道对话框的建立,即稍后我以编程方式结束通话。 ..但是如何获得对话框的引用,并关闭它?
I could actually almost know when the dialog is brought up, i.e. a little later I programmatically end the call...but how can I get a reference to the dialog, and close it?
推荐答案
设备的按键注入关闭按钮如下所示:
Key press injection for device Close button looks like this:
KeyEvent inject = new KeyEvent(KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
inject.post();
不要忘记设置设备版本的权限:
选项=>高级选项= >应用程序=> [您的应用程序] =>编辑默认权限=>交互=>键击注入
Don't forget to set permissions for device release: Options => Advanced Options => Applications => [Your Application] =>Edit Default permissions =>Interactions =>key stroke Injection
可能有用:
BlackBerry - 模拟一个KeyPress事件
代码示例:
class Scr extends MainScreen implements PhoneListener {
public Scr() {
Phone.addPhoneListener(this);
}
public boolean onClose() {
Phone.removePhoneListener(this);
return super.onClose();
}
public void callDisconnected(int callId) {
Timer timer = new Timer();
timer.schedule(new TimerTask(){public void run() {
KeyEvent event = new KeyEvent(KeyEvent.KEY_DOWN,
Characters.ESCAPE,
KeyListener.STATUS_NOT_FROM_KEYPAD);
event.post();
}}, 1000);
}
public void callAdded(int callId) {
}
public void callAnswered(int callId) {
}
public void callConferenceCallEstablished(int callId) {
}
public void callConnected(int callId) {
}
public void callDirectConnectConnected(int callId) {
}
public void callDirectConnectDisconnected(int callId) {
}
public void callEndedByUser(int callId) {
}
public void callFailed(int callId, int reason) {
}
public void callHeld(int callId) {
}
public void callIncoming(int callId) {
}
public void callInitiated(int callid) {
}
public void callRemoved(int callId) {
}
public void callResumed(int callId) {
}
public void callWaiting(int callid) {
}
public void conferenceCallDisconnected(int callId) {
}
}
这篇关于在BlackBerry上关闭系统对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!