beautypg.com

Interface dialerlistener, Sample dialerlistener implementation, Endcall – Motorola HANDSET C381P User Manual

Page 59

background image

12
Telephony
API

59

endCall

public void endCall()
throws

IOException

end or cancel a phone call
Throws:

IOException

- if the call could not be end or cancel.

Interface DialerListener

public interface DialerListener
The

DialerListener

interface provides a mechanism for the application to be notified

of phone call event.
When an event arrives, the

notifyDialerEvent()

method is called

The listener mechanism allows applications to receive TAPI voice call event without
needing to have a listener thread
If multiple event arrive very closely together in time, the implementation has calling this
listener in serial.

Sample DialerListener Implementation



Dialer listener program
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import com.motorola.*;

public class Example extends MIDlet implements DialerListener {
Dialer dialer;

// Initial tests setup and execution.

public void startApp() {
try {
dialer = Dialer.getDefaultDialer();

// Register a listener for inbound TAPI voice call events.
dialer.setDialerListener(this);
dialer.startCall("01065642288");

} catch (IOException e) {
// Handle startup errors
}