Call Log Editing

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Call Log Editing

Postby Draffodx » Tue Dec 15, 2009 2:55 pm

Just wondering is it possible to edit the call log on Android?

I want to be able to add an entry to the call log via my application.

Is this possible and how?

I already have called the call log and can display it.

I have also used getContentResolver().insert(CallLog.Calls.CONTENT_URI, values); to insert values.

These values appear when I print the call log in logcat but lead to the call log on the emulator crashing.

here is my code:

Code: Select all

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CallLog;
import android.util.Log;
import android.widget.SimpleCursorAdapter;

public class test extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        Uri myCall = ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, 0);

        Cursor cur = managedQuery(myCall, null, null, null, null);
        String[] projection = new String[] {
        Uri myCalls = CallLog.Calls.CONTENT_URI;
        Cursor managedCursor = managedQuery(myCalls,
                projection, // Which columns to return
                null,       // Which rows to return (all rows)
                null,       // Selection arguments (none)
                // Put the results in ascending order by name
                CallLog.Calls.DATE + " ASC");
    private void getColumnData(Cursor cur){
        if (cur.moveToFirst()) {

            String name = "";
            String phoneNumber ="";
            String duration;
            int nameColumn = cur.getColumnIndex(CallLog.Calls.CACHED_NAME);
            int phoneColumn = cur.getColumnIndex(CallLog.Calls.CACHED_NUMBER_LABEL);
            int durationColumn = cur.getColumnIndex(CallLog.Calls.DURATION);
            do {
                // Get the field values
                name = cur.getString(nameColumn);
                phoneNumber = cur.getString(phoneColumn);
                duration = cur.getString(durationColumn);
               Log.i("NAMES !!!!! = ", name);
               // Log.i("Number !!!!! = ", phoneNumber);
                Log.i("duration !!!!! = ", duration);
            } while (cur.moveToNext());

    private void addToCallLog(){
       ContentValues values = new ContentValues();

       // Add Abraham Lincoln to Calls List;
       values.put(CallLog.Calls.CACHED_NAME, "Abraham Lincoln2");
       //values.put(CallLog.Calls.CACHED_NUMBER_LABEL, "0863497543");
       values.put(CallLog.Calls.DURATION, 102);

       Uri uri = getContentResolver().insert(CallLog.Calls.CONTENT_URI, values);

Master Developer
Master Developer
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm


Postby Draffodx » Wed Dec 16, 2009 1:37 pm

It looks like its not possible to add to or edit anything in the Call Log, can anyone with more experience confirm this?
Master Developer
Master Developer
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby refill » Wed Jan 20, 2010 4:50 pm

hmm.. so late..

in AndroidMenifest.xml

u add next 2 lines

<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_CONTACTS"></uses-permission>

Once Poster
Once Poster
Posts: 1
Joined: Wed Jan 20, 2010 4:43 pm

Postby Draffodx » Thu Jan 21, 2010 11:48 am

Hi refill,

Thanks, have the call log working perfectly anyway :)
Master Developer
Master Developer
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm


Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 1 guest