Retrieve Call Details Tutorial
PUBLISHED
Retrieve Call Details Tutorial
Description
This article explains how to retrieve details of activities performed on a contact number from the Call logs using Tizen platform device API's. The article applies only for systems based on Tizen platform.
Pre-conditions
To use the Call API methods, you must declare the necessary features in the config.xml file.
- http://tizen.org/api/call: Using this feature, we can use the functionalities of the Call.
- http://tizen.org/api/call.history.read: Using this feature, we are able to read access to call history.
Call Details
By using tizen.call.history.find method you can fetch details of activities performed on a contact number from the Call logs. This is an asynchronous method and accepts following parameters:
-
successCallback:
This parameter is used as a Handler for query result set.
-
errorCallback :
Error Handler.
-
filter:
Search Criteria. This example retrieves details of activities performed using "1122334455" contact number.
-
sortMode:
The sortMode parameter manages the order preferences of the result set. In this example calls are sorted in descending order of thier start time.
-
limit:
Limits the query result set to maximum number given in the parameter.If 0, there is no limit set.
-
offset:
Specifies the offset in the result set, from where the results are listed.
$ var sortMode = new tizen.SortMode("startTime", "DESC");
$ var numberfilter = new tizen.AttributeFilter("remoteParties.remoteParty",
"EXACTLY",
"1122334455");
$ function onError(error) {
console.log ("Query is failed" + error.name);
}
$ function onSuccess(results) {
for (var i=0; i<results.length;i++) { // process the CallHistoryEntry
//Voice or VOIP call
console.log(CallType + ". " + results[i].callType);
//Start Time
console.log(startTime + ". " + results[i].startTime);
// Duration
console.log(duration + ". " + results[i].duration);
//Outgoing or incoming
console.log(direction + ". " + results[i].direction);
//Call Cost
console.log(cost + ". " + results[i].cost);
}
}
//Make the query and wire up the callbacks.
$ tizen.call.history.find(onSuccess, onError, numberfilter, sortMode);