I have to agree with Mike on this issue. On Aug 4, 1:23 pm, Mike dg <[email protected]> wrote: > Try just repeatedly deleting everything in the log regardless of the > state. A service that does this every 5 seconds should be very fast > and good. > > On Aug 4, 1:25 pm, Donald <[email protected]> wrote: > > > > > hi guys, > > > i have a application which will listen to incoming calls. so in the > > TelephonyManager.CALL_STATE_IDLE state which means the call is hung up > > i'm deleting the current number from the Call Log. > > > To delete the Call log i used ContentObserver which will notify me > > when a new entry is added to the Call Log. > > > 10 out of 8 times this works fine. but sometimes onChange(boolean b) > > is not notified > > > my guess is this can happen due to last entry is not added to the > > CallLog in CALL_STATE_IDLE state. so that means i'm doing this in a > > wrong place. > > > so guys could you please let me know when should i delete this call > > log?? > > > this is how i delete call log > > > case TelephonyManager.CALL_STATE_IDLE: > > > listeneNativeInbox(); > > > protected void listeneNativeInbox() { > > > context.getContentResolver().registerContentObserver( > > CallLog.Calls.CONTENT_URI, true, new > > MyInboxListener(handler)); > > > } > > > class MyInboxListener extends ContentObserver { > > > public MyInboxListener(Handler handler) { > > super(handler); > > // TODO Auto-generated constructor stub > > } > > > @Override > > public boolean deliverSelfNotifications() { > > // TODO Auto-generated method stub > > return false; > > } > > > @Override > > public void onChange(boolean selfChange) { > > // TODO Auto-generated method stub > > boolean b = false; > > Uri books = > > Uri.parse("content://com.sabretch.colorEyeD/SABRE"); > > Log.d("Authority", books.getAuthority()); > > Cursor cursor = > > context.getContentResolver().query(books, null, > > "Mobile" + "='" + phonenbr + "'", > > null, > > "category " + "DESC"); > > if (cursor != null) { > > if (cursor.moveToNext()) { > > b = true; > > } > > } > > Message msg = new Message(); > > msg.obj = "xxxxxxxxxx"; > > handler.sendMessage(msg); > > Cursor cur = context.getContentResolver().query( > > CallLog.Calls.CONTENT_URI, null, > > null, null, > > CallLog.Calls._ID + " DESC"); > > > cur.moveToNext(); > > long threadIdIn = cur > > > > .getLong(cur.getColumnIndex(CallLog.Calls._ID)); > > > /* > > * Uri uri = > > ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, > > * threadIdIn); > > */ > > if (b) { > > ContentValues values = new ContentValues(); > > values.put(CallLog.Calls.NUMBER, > > "4444444444"); > > values.put(CallLog.Calls.CACHED_NAME, > > "Unknown"); > > // values.put(CallLog.Calls.TYPE, > > CallLog.Calls.INCOMING_TYPE); > > // long time = System.currentTimeMillis() - > > 5000000; > > // values.put(CallLog.Calls.DATE, time); > > > // int x = > > context.getContentResolver().delete(uri, null, null); > > try { > > int x = > > context.getContentResolver().update( > > > > CallLog.Calls.CONTENT_URI, values, > > CallLog.Calls._ID + > > "='" + threadIdIn + "'", null); > > Log.d("FFFFFFFFFASSDSSDESD", > > Integer.toString(x)); > > // = true; > > } catch (Exception e) { > > // TODO: handle exception > > int x = > > context.getContentResolver().update( > > > > CallLog.Calls.CONTENT_URI, values, > > CallLog.Calls._ID + > > "='" + 0 + "'", null); > > // = true; > > } > > } > > System.exit(0); > > // } > > } > > } > > > regards, > > Donald
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

