I have come across this in the source ublic static Uri addCall(CallerInfo ci, Context context, String number, > int presentation, int callType, long start, int duration) { > final ContentResolver resolver = context.getContentResolver(); > > // If this is a private number then set the number to Private, > otherwise check > // if the number field is empty and set the number to > Unavailable > if (presentation == Connection.PRESENTATION_RESTRICTED) { > number = CallerInfo.PRIVATE_NUMBER; > if (ci != null) ci.name = ""; > } else if (presentation == Connection.PRESENTATION_PAYPHONE) { > number = CallerInfo.PAYPHONE_NUMBER; > if (ci != null) ci.name = ""; > } else if (TextUtils.isEmpty(number) > || presentation == Connection.PRESENTATION_UNKNOWN) { > number = CallerInfo.UNKNOWN_NUMBER; > if (ci != null) ci.name = ""; > } > > ContentValues values = new ContentValues(5); > > values.put(NUMBER, number); > values.put(TYPE, Integer.valueOf(callType)); > values.put(DATE, Long.valueOf(start)); > values.put(DURATION, Long.valueOf(duration)); > values.put(NEW, Integer.valueOf(1)); > if (ci != null) { > values.put(CACHED_NAME, ci.name); > values.put(CACHED_NUMBER_TYPE, ci.numberType); > values.put(CACHED_NUMBER_LABEL, ci.numberLabel); > } > > if ((ci != null) && (ci.person_id > 0)) { > ContactsContract.Contacts.markAsContacted(resolver, > ci.person_id); > } > > Uri result = resolver.insert(CONTENT_URI, values); > > removeExpiredEntries(context); > > return result; > } >
Could I use this in some way and how do I go about it? Thanks, Donal On Wed, Dec 16, 2009 at 11:02 AM, Donal Rafferty <draf...@gmail.com> wrote: > Hi Kumar, > > The idea is to show calls made over wi fi or 3G from another application in > the Call Log as if they were made over GSM. > > You reckon looking at the source will be the only way? > > Thanks, > > Donal > > > On Wed, Dec 16, 2009 at 10:33 AM, Kumar Bibek <coomar....@gmail.com>wrote: > >> Hi Donal, >> >> This is as good as hacking. I guess, adding a new call log should not >> be possible. However, deleting them should be possible by using the >> Content Provider. >> >> You need to re-read the documentations, or may be look at the source >> codes. >> >> Kumar Bibek >> http://tech-droid.blogspot.com >> >> On Dec 15, 5:57 pm, Donal Rafferty <draf...@gmail.com> wrote: >> > Here is the code I have >> > >> > import android.app.Activity; >> > >> > >> > >> > > import android.content.ContentUris; >> > > import android.content.ContentValues; >> > > import android.content.Context; >> > > import android.database.Cursor; >> > > import android.net.Uri; >> > > 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. */ >> > > @Override >> > > public void onCreate(Bundle savedInstanceState) { >> > > super.onCreate(savedInstanceState); >> > > setContentView(R.layout.main); >> > >> > > Uri myCall = >> ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, >> > > 0); >> > >> > > Cursor cur = managedQuery(myCall, null, null, null, null); >> > >> > > String[] projection = new String[] { >> > > CallLog.Calls.CACHED_NAME, >> > > CallLog.Calls.CACHED_NUMBER_LABEL, >> > > CallLog.Calls.DURATION >> > > }; >> > >> > > 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"); >> > > this.addToCallLog(); >> > > this.getColumnData(managedCursor); >> > > } >> > >> > > 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); >> > > String imagePath; >> > >> > > 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); >> > >> > > } >> > >> > > } >> > >> > This works in that the logcat shows that its adding the duration, >> however >> > problems include: >> > >> > Not getting the phonenumber, this gives a uncaughtexception error >> > >> > And the emulator crashes the Call Log app thats already on the device >> when >> > it is used after my app has run >> > >> > On Tue, Dec 15, 2009 at 12:22 PM, draf...@gmail.com <draf...@gmail.com >> >wrote: >> > >> > > Hi, >> > >> > > I have been looking at Androids call log content provider and have >> > > managed to pull the data from it and display it in my own app. >> > >> > > However I want to be able to write to the call log, is there anyway of >> > > doing this? >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en