Code Sample; Code Sample: Calculating The Time Spent On The Phone By A Participant - Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual

Blackberry device applications integration guide
Table of Contents

Advertisement

BlackBerry Device Applications Integration Guide
Task
Retrieve a call participant by phone
number.
Retrieve the phone number type.
Create a call log or conference call log.
Delete a call log.

Code sample

Code sample: Calculating the time spent on the phone by a participant

Example: PhoneLogsDemo.java
/**
* PhoneLogsDemo.java
* Copyright (C) 2001-2005 Research In Motion Limited. All rights reserved.
*/
package com.rim.samples.docs.phonelogs;
import net.rim.blackberry.api.phone.phonelogs.*;
54
Steps
PhoneCallLogID
The
class identifies participants in a phone call log by phone number.
PhoneCallLog.getParticipant(int)
>
Invoke
ConferencePhoneCallLog.getParticipantAt().
PhoneCallLogID participant = phoneCallLog.getParticipant();
PhoneCallLogID participant = ConferencePhoneCallLog.getParticipant();
honeCallLogID
The P
class identifies the type of phone call for a log. For example, home, mobile,
work, or fax, as recorded in the address book.
PhoneCallLogID.getType()
>
Invoke
String phoneType = PhoneCallLogID.getType();
PhoneCallLogID
The
constructor removes dashes and other non-numeric characters from phone
numbers.
PhoneCallLog
1. Create an instance of a
the date, duration, participants, and notes for the call as parameters to the constructor.
Date date = new Date("1000"); // date of call
int duration = 60; // duration of call
PhoneCallLogID caller1 = new PhoneCallLogID("555-1234"); // first
participant
PhoneCallLogID caller2 = new PhoneCallLogID("555-1235"); // second
participant
String notes = "New call."; // notes
ConferencePhoneCallLog conferenceCall = new
ConferencePhoneCallLog(date, duration,
PhoneLogs.FOLDER_NORMAL_CALLS, caller1, caller2, notes);
2. Update the call log:
• To update the call log, invoke
_logs.addCall(conferenceCall);
• To replace the call log with a new call log, invoke
call,int index,long folderID)
_logs.swapCall(conferenceCall, 0, FOLDER_NORMAL_CALLS);
PhoneLogs.deleteCall().
>
Invoke
_logs.deleteCall(0);
or
.
ConferencePhoneCallLog
or
PhoneLogs.addCall(CallLog call).
PhoneLogs.swapCall(CallLog
object, and provide

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents