Permission in AndroidManifest.xml:
Add the READ_CONTACTS permission to your AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_CONTACTS" />
Code :
public static void getAllCallLogs(ContentResolver cr) {
//reading all data in descending order according to DATE
String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
Uri callUri = Uri.parse("content://call_log/calls");
Cursor cur = cr.query(callUri, null, null, null, strOrder);
// loop through cursor
while (cur.moveToNext()) {
CallDataLog callLog = new CallDataLog();
String callNumber = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.NUMBER));
String callName = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.CACHED_NAME));
String callDate = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.DATE));
String callType = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.TYPE));
String isCallNew = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.NEW));
String duration = cur.getString(cur.getColumnIndex(android.provider.CallLog.Calls.DURATION));
// process log data...
}
}
Hi, How can i get the last call details after call end in android
ReplyDeleteHi,how can i get last 7days of call log history,i need query
ReplyDeleteHi,how can i get last 7days of calllog history
ReplyDeletehow to call this getalllogdetails()
ReplyDeletehow to get the call history of a particular contact??
ReplyDeleteThis comment has been removed by the author.
ReplyDelete