Is it by anyway possible to write to call logs database?? I mean i want to add selected numbers to the call history. I tried searching the tutorial on net but couldn't find any... Though 1 thing is for sure, IT CAN BE DONE. coz i have seen lots of applications online, which restore call logs, so i guess we can modify the call history database somehow(but how exactly is not clear with me).
i already read this post but it happens to be posted a long time back.
Any help will be appreciated! Thanx!
You can use this snippet to add new records to the existing Call logs content provider:
public static void insertPlaceholderCall(ContentResolver contentResolver, String number){
ContentValues values = new ContentValues();
values.put(CallLog.Calls.NUMBER, number);
values.put(CallLog.Calls.DATE, System.currentTimeMillis());
values.put(CallLog.Calls.DURATION, 0);
values.put(CallLog.Calls.TYPE, CallLog.Calls.OUTGOING_TYPE);
values.put(CallLog.Calls.NEW, 1);
values.put(CallLog.Calls.CACHED_NAME, "");
values.put(CallLog.Calls.CACHED_NUMBER_TYPE, 0);
values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "");
Log.d(TAG, "Inserting call log placeholder for " + number);
contentResolver.insert(CallLog.Calls.CONTENT_URI, values);
}
(Code taken from Google Voice Callback for Android)
Remember to add the permissions in the Manifest
<uses-permission
android:name="android.permission.READ_CONTACTS"/>
<uses-permission
android:name="android.permission.WRITE_CONTACTS"/>
The linked post explains it very well so I don't know why you are asking again. You cannot modify the call logs unless you keep your own database or your own firmware.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With