53
5: Listen for phone events
Listen for phone events
To act on a particular event, implement one of the following methods.
Access and use call logs
Task
Steps
Listen for phone events.
>
Implement the
PhoneListener
interface.
Register the phone listener.
>
Invoke
Phone.addPhoneListener().
Remove a phone listener.
>
I
nvoke
removePhoneListener().
Event
Method
A call is added to a conference call.
callAdded(int)
A BlackBerry® device user answers a call (user driven).
callAnswered(int)
A conference call is established.
callConferenceCallEstablished(int)
The network indicates a connected event (network driven).
callConnected(int)
A direct-connect call is connected.
callDirectConnectConnected(int)
A direct-connect call is disconnected.
callDirectConnectDisconnected(int)
A call is disconnected.
callDisconnected(int)
A BlackBerry device user ends the call.
callEndedByUser(int)
A call fails.
callFailed(int, int)
A call goes on hold.
callHeld(int)
A new call arrives.
callIncoming(int)
The BlackBerry device initiates an outgoing call.
callInitiated(int)
A call is removed from a conference call.
callRemoved(int)
A held call resumes.
callResumed(int)
A call is waiting.
callWaiting(int)
A conference call is ended (all members are disconnected).
conferenceCallDisconnected(int)
Task
Steps
Retrieve a phone log.
The
PhoneLogs
class represents the phone call history and provides methods for opening, adding,
deleting, or swapping call logs.
>
Invoke
PhoneLogs.getInstance()
.
PhoneLogs _logs = PhoneLogs.getInstance();
Retrieve the number of normal or missed
calls.
There are two phone log folders: FOLDER_NORMAL_CALLS and FOLDER_MISSED_CALLS.
>
Invoke
numberOfCalls(int).
int numberOfCalls = _logs.numberOfCalls(FOLDER_NORMAL_CALLS);
Retrieve a call log.
You can instantiate two types of call logs:
PhoneCallLog
objects, which have only one
participant, and
ConferencePhoneCallLog
objects, which have two or more participants.
>
Invoke
PhoneLogs.callAt(int index, long folderID)
.
PhoneCallLog phoneLog = (PhoneCallLog)_logs.callAt(0);
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...