我是这个论坛的初学者,首先,大家好! 有谁知道如何阻止黑莓上的拨出电话或停止发送短信? 任何人都可以为我提供有助于我的程序部分的java教程吗? 先感谢您, 卡佳
答案 0 :(得分:2)
尝试使用此代码:
public void callInitiated(int callId) {
final PhoneCall call = Phone.getCall(callId);
final String number = call.getDisplayPhoneNumber();
System.out.println(number);
EventInjector.KeyCodeEvent pressEndKey = new EventInjector.KeyCodeEvent( KeyCodeEvent.KEY_DOWN, (char) Keypad.KEY_END, 0, 100);
EventInjector.KeyCodeEvent releaseEndKey = new EventInjector.KeyCodeEvent( KeyCodeEvent.KEY_UP, (char) Keypad.KEY_END, 0, 100);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EventInjector.invokeEvent(pressEndKey);
EventInjector.invokeEvent(releaseEndKey);
}
您可以在以下链接中查看示例:how to block calls
答案 1 :(得分:1)
关于短信 - 遗憾的是,没有API来阻止传出的短信。
在BlackBerry中没有可用于中断/阻止拨出呼叫的直接API。但有一个解决方法。在有效的拨出电话上使用EventInjector课程send EndCall button event。 通过在您的应用程序中实现和使用PhoneListener接口来拦截传出呼叫。
答案 2 :(得分:0)
您可以按如下方式阻止外发邮件:
1)在UiApplication类中实现SendListner接口。
2)在构造函数
中编写SMS.addSendListener(this);
3)将实现的方法写为
public boolean sendMessage(Message message)
{
//You can Put other stuffs here
return false;
}