Skip to content

Phone Calls History

Phone Call History – easy to use APIs for querying call history. Component provides dedicated APIs for querying answered, missed, rejected calls.

1. Dependencies

Open the build.gradle file for your project and add the following dependencies:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dependencies {
    //for receiving notifications about incoming calls and ongoing call statuses
    implementation "com.telenav.sdk.vivid:android-sdk-phonecall-notification:${sdk_version}" 

    //for making phone calls
    implementation "com.telenav.sdk.vivid:android-sdk-phonecall-dial:${sdk_version}" 

    //for retrieving history
    implementation "com.telenav.sdk.vivid:android-sdk-phonecall-history:${sdk_version}" 
}

2. View the Call History

Permissions

Permissions

1
<uses-permission android:name="android.permission.READ_CALL_LOG" />

3. Get Phone Calls History (with filtering - all, received call, made calls, missed calls)

Create a phone calls history data access object.

1
2
3
4
val dataAccess = PhoneCallsHistoryDataAccess.Factory().createDataAccess(
    context.contentResolver,
    PhoneCallsHistoryDataAccess.DataAccessType.BASE
)

3. Query types

In order to query the phone logs, you need to create a Query instance. You can find below the supported types of quiries:

Add a filter for full history data.

1
val queryBuilder = Query.Builder().full()

Add a filter for answered calls.

1
val queryBuilder = Query.Builder().answered()

Add a filter for missed calls.

1
val queryBuilder = Query.Builder().missed()


Add a filter for made calls.

1
val queryBuilder = Query.Builder().outgoing()

Add a filter for rejected calls.

1
val queryBuilder = Query.Builder().rejected()

Add a filter for reading history since a given date. The date Parameter represents the date since the history will be filtered.

1
val queryBuilder = Query.Builder().since(date)

Combined queries

The queries can also be combined. For example: Filter for reading history since the @date filtered by outgoing and missed calls.

1
val queryBuilder = Query.Builder().since(date).outgoing().missed()


In order to query the dataAccess, you need to call the find method. The queryBuider Parameter represents the Query.Builder and returns a list of HistoryRecord.

1
2
3
4
// 
dataAccess.find(
    queryBuilder
)

4. Clear Phone Calls History

Info

Not yet implemented.