Last active
May 9, 2020 05:10
-
-
Save HammadMaqbool/f9d3df1bad32971d3d8dde671dadf3ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] requestedColumns = { CallLog.Calls.CACHED_NUMBER_LABEL, CallLog.Calls.DURATION }; | |
Cursor calls = managedQuery( CallLog.Calls.CONTENT_URI, requestedColumns, | |
CallLog.Calls.CACHED_NUMBER_LABEL+ " = ?", new String[] { "HourlyClient123" } , null); | |
Log.d(DEBUG_TAG, "Call count: " + calls.getCount()); | |
int durIdx = calls.getColumnIndex(CallLog.Calls.DURATION); | |
int totalDuration = 0; | |
calls.moveToFirst(); | |
while (!calls.isAfterLast()) | |
{ | |
Log.d(DEBUG_TAG, "Duration: " + calls.getInt(durIdx)); | |
totalDuration += calls.getInt(durIdx); | |
calls.moveToNext(); | |
} | |
Log.d(DEBUG_TAG, "HourlyClient123 Total Call Duration: " + totalDuration); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment