Motorola E680 Technical Manual - Page 77

Interface DialerListener, Sample DialerListener Implementation

Page 77 highlights

17 Telephony API 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 } } Asynchronous callback for receive phone call event public void notifyDialerEvent(Dialer dialer, byte event) { switch (event) { 77

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107

17
Telephony API
77
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
}
}
Asynchronous callback for receive phone call event
public void notifyDialerEvent(Dialer dialer, byte event) {
switch (event) {