2011-09-18 78 views

回答

1

關於短信 - 不幸的是沒有API來阻止傳出的短信。

在BlackBerry中沒有可用於中斷/阻止傳出呼叫的直接API。但有一個解決方法。使用EventInjector類別至send EndCall button event進行主動傳出呼叫。 通過在應用程序中實現並使用PhoneListener接口來攔截傳出呼叫。

+1

非常感謝你寫SMS.addSendListener(this);

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

0

您可以阻止傳出消息如下:

1)implemnt SendListner接口您UiApplication類。

2)構造

3)寫的實現方法,

public boolean sendMessage(Message message) 
    { 
      //You can Put other stuffs here 
     return false; 
    }