0

I have to develop application to get the call duration. At the end of the call, application read the duration of current call and upload data to server.some time call log return previous call duration because it takes few seconds to refresh log. I'm using below mentioned codes to read call log. Is there any way to refresh call log programmatically?

private int UpdateTelNoLog(String strTelNo) 
{       
    int duration=0;
    String strOrder = CallLog.Calls.DATE + " DESC";
        String selection = android.provider.CallLog.Calls.NUMBER + "='" + strTelNo + "'";
        Cursor managedCursor =myContext.getContentResolver().
                    query(CallLog.Calls.CONTENT_URI, null, selection, null, strOrder);

        if(managedCursor.getCount()>0)
        {
            managedCursor.moveToFirst();                        
            int date = managedCursor.getColumnIndex( CallLog.Calls.DATE);
            duration = managedCursor.getColumnIndex( CallLog.Calls.DURATION);
        }
    return duration ;
}
4

1 に答える 1