Tutorials Blackberry How to Block Incoming Call in Blackberry

How to Block Incoming Call in Blackberry

BlackBerry application can listen to the status of incoming and outgoing phone calls. To do this our application must implement the PhoneListener interface (net.rim.blackberry.api.phone.PhoneListener) or AbstractPhoneListener class (net.rim.blackberry.api.phone.AbstractPhoneListener). The following code sample illustrates the implementation of the PhoneListener interface to block incoming call. EventInjector class is used to inject events into the system. This element is only accessible by signed applications. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

Here is a sample code demonstrate, to reject the call that comes from all number. You can also customize as per your requirement by just putting some set of conditions with phone number.

import net.rim.blackberry.api.phone.Phone;
import net.rim.blackberry.api.phone.PhoneCall;
import net.rim.blackberry.api.phone.PhoneListener;
import net.rim.device.api.system.Application;
import net.rim.device.api.system.EventInjector;
import net.rim.device.api.system.EventInjector.KeyCodeEvent;
import net.rim.device.api.ui.Keypad;

public class CallReject extends Application implements PhoneListener {

public CallReject() {
    Phone.addPhoneListener(this);
}

public static void main(String[] args) {
      new CallReject().enterEventDispatcher();
}

public void callAdded(int callId) {
   //put your condition here for blocking call
}

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 callDisconnected(int callId) {}

public void callEndedByUser(int callId) {}

}
Total
0
Shares
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Raghav
Raghav
9 years ago

Nice post. I am able to do my own Call Blocking application in blackberry.

Previous Post
Blackberry Tutorials

How to Record Incoming Phone Call in Blackberry

Next Post
Blackberry Tutorials

Prioritizing the network connections in Blackberry

Related Posts
By clicking “Allow All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Notice
Allow All