The Logging Service API allows widgets to access mobile device logging events such as call logs, messaging logs, and data logs. You can use the Logging Service to create widgets that add, read, and delete logging events. For example, you can create widgets that:
Automatically delete the records of received calls older than a specified number of days
Create unique records of calls based on criteria such as call duration
Provide useful information to mobile device users such as the number of MB of data sent and received for the day
To create a service
object for the Logging Service API, use Service.Logging
to
identify the service provider and IDataSource
to identify
the supported interface:
var so = device.getServiceObject("Service.Logging", "IDataSource");
The IDataSource
interface provides the following
methods:
Use the Add()
method to add an entry to the event
log; for example, to create new types of application-specific log entries.
Use the GetList()
method to retrieve event details
such as phone number or call duration from the event log.
Use the Delete()
method to delete an entry from
the event log.
Use the RequestNotification()
method to request
notification of updates to the event log.
Use the Cancel()
method to cancel an ongoing asynchronous
call. This method is valid for any asynchronous call made through the Logging
Service API.
To access and manage logs using the Logging Service API:
Create a service
object for the API using device.getServiceObject()
.
Define the tasks you want to perform and choose the correct methods for them.
Optionally, define how you want the results filtered.
Define functions to process the results.
Retrieve the results.
Process the results.
For the complete source of a sample widget that demonstrates how to use this service, see the full example.