beautypg.com

Motorola HANDSET C381P User Manual

Page 60

background image

12
Telephony
API

60

}
Asynchronous callback for receive phone call event
public void notifyDialerEvent(Dialer dialer, byte event) {
switch (event) {
case DialerEvent.PHONE_VOICECALL_INIT:
// your process

break;

case DialerEvent.PHONE_VOICECALL_FAILURE:
// your process

break;

case DialerEvent.PHONE_VOICECALL_CONNECT:
// your process

break;

case DialerEvent.PHONE_VOICECALL_DISCONNECT:
// your process

break;

case DialerEvent.PHONE_VOICECALL_TIMEOUT:
// your process

break;

case DialerEvent.PHONE_VOICECALL_HOLD:
// your process

break;

case DialerEvent.PHONE_VOICECALL_UNHOLD:
// your process

break;

case DialerEvent.PHONE_VOICECALL_DTMF_FAILURE:
// your process

break;

}
}

// Required MIDlet method - release the connection and
// signal the reader thread to terminate.

public void pauseApp() {
try {
dialer.endCall();
} catch (IOException e) {
// Handle errors
}
}

// Required MIDlet method - shutdown.
// @param unconditional forced shutdown flag

public void destroyApp(boolean unconditional) {
try {
dialer.setDialerListener(null);
dialer.endCall();
} catch (IOException e) {
// Handle shutdown errors.
}
}
}

Code Sample 7 DialerListener Implementation