Delete Call Log entry Exception

by mike » Mon, 21 Jun 2010 16:11:52 GMT


Sponsored Links
 i guys,

i have a BroadCastReceiver which will listen to incoming calls. and
once the call is finish or users ignores the call i'm deleting the
number from the CallLog. i have tested this with HTC TATTOO and it
works fine there.

but when i tested this with Motorola MilesTone i'm getting a exception

this is the Exception

06-21 13:34:02.365: ERROR/DatabaseUtils(1337): Writing exception to
parcel
06-21 13:34:02.365: ERROR/DatabaseUtils(1337):
java.lang.UnsupportedOperationException: Cannot delete that URL:
content://call_log/calls/442
06-21 13:34:02.365: ERROR/DatabaseUtils(1337): at
com.android.providers.contacts.CallLogProvider.delete(CallLogProvider.java:
197)
06-21 13:34:02.365: ERROR/DatabaseUtils(1337): at
android.content.ContentProvider$Transport.delete(ContentProvider.java:
174)
06-21 13:34:02.365: ERROR/DatabaseUtils(1337): at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:
180)
06-21 13:34:02.365: ERROR/DatabaseUtils(1337): at
android.os.Binder.execTransact(Binder.java:287)
06-21 13:34:02.365: ERROR/DatabaseUtils(1337): at
dalvik.system.NativeStart.run(Native Method)



06-21 13:34:02.381: ERROR/AndroidRuntime(1593): Uncaught handler:
thread main exiting due to uncaught exception
06-21 13:34:02.459: ERROR/AndroidRuntime(1593):
java.lang.UnsupportedOperationException: Cannot delete that URL:
content://call_log/calls/442

this is my code

public class CallListener extends BroadcastReceiver {
private Context context;
String phonenbr;
TelephonyManager telManager;
Handler handler = new Handler();

@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
this.context = context;
telManager = (TelephonyManager) context

.getSystemService(Context.TELEPHONY_SERVICE);
telManager.listen(new StateListener(),
PhoneStateListener.LISTEN_CALL_STATE);

}

class StateListener extends PhoneStateListener {
@Override
public void onCallStateChanged(int state, String
incomingNumber) {
// TODO Auto-generated method stub
// super.onCallStateChanged(state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_RINGING:
break;
case TelephonyManager.CALL_STATE_IDLE:

listeneNativeInbox();
break;
case TelephonyManager.CALL_STATE_OFFHOOK:

break;
}
}
}
protected void listeneNativeInbox() {

context.getContentResolver().registerContentObserver(
CallLog.Calls.CONTENT_URI, true, new
MyInboxListener(handler));

// Uri Sms = Uri.parse("content://sms/inbox");
/*
* Cursor c = context.getContentResolver().query(
* CallLog.Calls.CONTENT_URI, null, null, null, null);
*/
}

class MyInboxListener extends ContentObserver {

public MyInboxLi



Delete Call Log entry Exception

by Kumar Bibek » Mon, 21 Jun 2010 16:27:02 GMT


 learly a permission issue. Only HTC can help you/ Motorola also.

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 21, 1:11pm, mike <hasitharand...@gmail.com> wrote:

--


Sponsored Links


Delete Call Log entry Exception

by mike » Mon, 21 Jun 2010 17:35:21 GMT


 hi Bibek,

what make you think like that it's the same application. i didn't
change a single line of code. both application has same permissions.

regards,
MIke

--



Delete Call Log entry Exception

by Kumar Bibek » Mon, 21 Jun 2010 18:18:57 GMT


 Well, the content providers might have been changed by HTC or
Motorola.....IF they disabled the delete action from the call logs,
your app cannot delete.

Had it been the same manufacturers or devices, then I would have
thought about some other problem.

java.lang.UnsupportedOperationException: Cannot delete that URL:
content://call_log/calls/442

The delete is unsupported on Motorola.

Thanks and Regards,
Kumar Bibek
 http://tech-droid.blogspot.com 





--



Delete Call Log entry Exception

by mike » Mon, 21 Jun 2010 19:29:21 GMT


 hi Bibek,

which is a good point. so i decide to update the call log for the same
uri. then i'm getting a null pointer exception.

int x = context.getContentResolver().update(uri, null, null,null);

what will be the issue?? do i have to pass values here??

regards,
MIke

--



Delete Call Log entry Exception

by Shyam » Wed, 21 Jul 2010 16:25:23 GMT


 Hi I this this code would solve your Purpose.

* This class newly added by Shyam Ananthakrishnan, is meant to
manipulate with the Android call log.
 * Author : Android Automation Team - Shyam Ananthakrishnan
(shyam.ananthakrish...@lntinfotech.com)
 * Date   : 2nd July 2010
 * Purpose: ASE functions that manipulates around the Call log feature
like monitoring the call log counter,
 *          Deleting the entries in call log etc.
 */



package com.google.ase.facade;

import android.app.Activity;
import android.app.Service;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CallLog;

import com.google.ase.jsonrpc.RpcReceiver;
import com.google.ase.rpc.Rpc;

/************************************* Enhanced by Shyam
Ananthakrishnan**************************/

public class CallLogFacade extends Activity implements RpcReceiver {

        private final Service mService;
        private static final Uri CONTENT_URI = Uri.parse("content://call_log/
calls");
        Cursor c = null;
        // constructor that initializes the Service.
        public CallLogFacade(Service service) {
            mService = service;
          }


        @Rpc(description = "gets the count from the call log")
        public int callLogCount()
        {

                try
                {
                        //String[] projection = new String []{Calls._ID};
                        c =  mService.getContentResolver().query(CONTENT_URI,
null,null,null,null);
                        System.out.println("Cursor Count"+c.getCount());

                }
                catch(Exception e)
                {
                        e.getMessage();
                }
                return c.getCount();
        }

        @Rpc(description = "Deletes all the call Log Entries")
        public void deleteEntriesFromCallLog()
        {
                try
                {
                        ContentResolver cr = mService.getContentResolver();
                        Uri uri = CONTENT_URI;
                        cr.delete(uri, null, null);
                }
                catch(Exception e)
                {
                        e.getMessage();
                }

        }


        @Rpc(description = "Deletes an Entry from call Log ")
        public void deleteAnEntryFromCallLog(String number)
        {
                try
                {
                        Uri CALLLOG_URI = Uri.parse("content://call_log/calls");
        
mService.getContentResolver().delete(CALLLOG_URI,CallLog.Calls.NUMBER
+"=?",new String[]{number});
                }
                catch(Exception e)
                {
                        e.getMessage();
                }
        }






        /************************************* EOD - Shyam
Ananthakrishnan**************************/





--



Other Threads

1. Setting/Passing values

How do you set/pass values from one screen (activity) to another?

What I have in the R.layout.main view labeled Calculator contains the
code for doing calculations.
The main.xml contains the layout (view) of the main screen.

I have created an options menu which has another screen which shows
you setup (R.layout.setup).
The dialogsetup.xml contains the layout (view) for it.

When you press the menu button, you get the options menu.  If you
select "Setup", then
it will display the setup screen.  Now what I need to do is take the
values from the setup screen (radio button and text values)
and place them in the main screen so that when you exit the setup
screen and go back to the main
screen, you can take those values and use them in your main code.

Any coding would be appreciated.

-- 

2. Porting android To a new arch

Hi,friends.
I want to port android2.2 to a new arch which is none-arm,none-mips.
The cpu's core is called unicore,which is new. Now I get the toolchain
which is compatible with gcc. The linux kernel is running properly.
I want to know except dalvik and bionic,what other arch-related
features of android I need to complete before getting android running
beautiful. Thanks.
by the way,bionic now is almost good & as i know dalvik has a none-arm
solution with the help of libffi. Anybody knows can i turn off the
prelink and strip feature of android?

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. black screen on tablet (port of froyo)

4. about android prelink:does not have a hash table!

5. Samsung MediaPlayer Question

6. resize a view

7. Corrupt installation