problem in sms

Put your problem here if it does not fit any of the other categories.

problem in sms

Postby soniya » Tue Oct 14, 2008 9:40 am

plz help me out..
i use for delete sms from in inbox
i use:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Cursor c = context.getContentResolver().query(Uri.parse("content://
  2.  
  3. sms/inbox"), null,null, null, null);
  4.  
  5.                    Log.d("TAG", "Read " + Integer.toString(c.getCount())
  6.  
  7. + " SMS messages from content (" +
  8.  
  9. Integer.toString(c.getColumnCount()) + " columns)");
  10.  
  11.                    Log.i("eeeeeer","555555555555555==1==="+c.getCount());
  12.  
  13.                    //Uri mUri=intent.getData();
  14.  
  15.                    Uri mUri=Uri.parse("content://sms/
  16.  
  17. inbox/"+c.getCount());
  18.  
  19.                    Log.i("uri ","deedededede"+mUri);
  20.  
  21.                    c.close();
  22.  
  23.                    c = null;
  24.  
  25.                    context.getContentResolver().delete(mUri, null,
  26.  
  27. null);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


and i have permission:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-
  2.  
  3. permission>
  4.  
  5. <uses-permission android:name="android.permission.READ_SMS"></uses-
  6.  
  7. permission>
  8.  
  9. <uses-permission android:name="android.permission.SEND_SMS"></uses-
  10.  
  11. permission>
  12.  
  13. <uses-permission android:name="android.permission.WRITE_SMS"></uses-
  14.  
  15. permission>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


but i have error:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. 10-14 13:54:41.903: INFO/eeeeeer(430): 555555555555555==1===14
  2.  
  3. 10-14 13:54:41.903: INFO/uri(430): deededededecontent://sms/inbox/14
  4.  
  5. 10-14 13:54:41.983: ERROR/DatabaseUtils(88): Writing exception to
  6.  
  7. parcel
  8.  
  9. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):
  10.  
  11. java.lang.IllegalArgumentException: Unknown URL
  12.  
  13. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):     at
  14.  
  15. com.android.providers.telephony.SmsProvider.delete(SmsProvider.java:
  16.  
  17. 510)
  18.  
  19. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):     at
  20.  
  21. android.content.ContentProvider$Transport.delete(ContentProvider.java:
  22.  
  23. 149)
  24.  
  25. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):     at
  26.  
  27. android.content.ContentProviderNative.onTransact(ContentProviderNative.java:
  28.  
  29. 149)
  30.  
  31. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):     at
  32.  
  33. android.os.Binder.execTransact(Binder.java:276)
  34.  
  35. 10-14 13:54:41.983: ERROR/DatabaseUtils(88):     at
  36.  
  37. dalvik.system.NativeStart.run(Native Method)
  38.  
  39. 10-14 13:54:42.032: DEBUG/AndroidRuntime(430): Shutting down VM
  40.  
  41. 10-14 13:54:42.042: WARN/dalvikvm(430): threadid=3: thread exiting
  42.  
  43. with uncaught exception (group=0x40010e28)
  44.  
  45. 10-14 13:54:42.042: ERROR/AndroidRuntime(430): Uncaught handler:
  46.  
  47. thread main exiting due to uncaught exception
  48.  
  49. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):
  50.  
  51. java.lang.RuntimeException: Unable to start receiver
  52.  
  53. org.sms.ServerMessagesReceiver: java.lang.IllegalArgumentException:
  54.  
  55. Unknown URL
  56.  
  57. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  58.  
  59. android.app.ActivityThread.handleReceiver(ActivityThread.java:2289)
  60.  
  61. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  62.  
  63. android.app.ActivityThread.access$2700(ActivityThread.java:112)
  64.  
  65. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  66.  
  67. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1628)
  68.  
  69. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  70.  
  71. android.os.Handler.dispatchMessage(Handler.java:88)
  72.  
  73. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  74.  
  75. android.os.Looper.loop(Looper.java:123)
  76.  
  77. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  78.  
  79. android.app.ActivityThread.main(ActivityThread.java:3742)
  80.  
  81. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  82.  
  83. java.lang.reflect.Method.invokeNative(Native Method)
  84.  
  85. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  86.  
  87. java.lang.reflect.Method.invoke(Method.java:515)
  88.  
  89. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  90.  
  91. com.android.internal.os.ZygoteInit
  92.  
  93. $MethodAndArgsCaller.run(ZygoteInit.java:739)
  94.  
  95. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  96.  
  97. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
  98.  
  99. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  100.  
  101. dalvik.system.NativeStart.main(Native Method)
  102.  
  103. 10-14 13:54:42.073: ERROR/AndroidRuntime(430): Caused by:
  104.  
  105. java.lang.IllegalArgumentException: Unknown URL
  106.  
  107. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  108.  
  109. android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:
  110.  
  111. 128)
  112.  
  113. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  114.  
  115. android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:
  116.  
  117. 110)
  118.  
  119. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  120.  
  121. android.content.ContentProviderProxy.delete(ContentProviderNative.java:
  122.  
  123. 362)
  124.  
  125. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  126.  
  127. android.content.ContentResolver.delete(ContentResolver.java:386)
  128.  
  129. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  130.  
  131. org.sms.ServerMessagesReceiver.onReceive(ServerMessagesReceiver.java:
  132.  
  133. 76)
  134.  
  135. 10-14 13:54:42.073: ERROR/AndroidRuntime(430):     at
  136.  
  137. android.app.ActivityThread.handleReceiver(ActivityThread.java:2280)
Parsed in 0.045 seconds, using GeSHi 1.0.8.4
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Top

Postby MrSnowflake » Tue Oct 14, 2008 9:42 am

Seems like the sms you're trying to delete doesn't exists:
Code: Select all
10-14 13:54:41.983: ERROR/DatabaseUtils(8:
java.lang.IllegalArgumentException: Unknown URL
10-14 13:54:41.983: ERROR/DatabaseUtils(8: at
com.android.providers.telephony.SmsProvider.delete(SmsProvider.java:
510)
Last edited by MrSnowflake on Tue Oct 14, 2008 9:46 am, edited 1 time in total.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby soniya » Tue Oct 14, 2008 9:45 am

thanks for reply
but how to delete sms from inbox...
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby MrSnowflake » Tue Oct 14, 2008 9:46 am

Woops, Seems like the sms you're trying to delete doesn't exists:
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby soniya » Tue Oct 14, 2008 12:12 pm

i know it....
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby soniya » Tue Oct 14, 2008 1:37 pm

Anyone???
what URL use??
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Top

Postby plusminus » Tue Oct 14, 2008 2:37 pm

That doesn't make sense to me...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Uri mUri=Uri.parse("content://sms/inbox/"+c.getCount());
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby MrSnowflake » Tue Oct 14, 2008 2:40 pm

plusminus wrote:That doesn't make sense to me...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Uri mUri=Uri.parse("content://sms/inbox/"+c.getCount());
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
Now you say so, c.getCount() would return the number of sms messages, but the last message in the list would be (c.getCount()-1)!
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby soniya » Tue Oct 14, 2008 3:31 pm

i have 12 sms in inbox..
im try with

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Uri mUri=Uri.parse("content://sms/inbox/4");
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


but i get same error
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby soniya » Tue Oct 14, 2008 3:36 pm

plz reply it's very urgent......
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

SMS Delete

Postby stilwalli » Wed Oct 15, 2008 1:48 pm

has anyone been able to delete SMS from the inbox.

I was try to get a particular SMS row using the following command
Cursor c = context.getContentResolver().query(Uri.parse("content://sms/inbox"), proj ,"thread_id='981111'", null, null);

but I always keep getting error compiling query.

When I look at the log carefully I find that, the query is

select * from sms where (type=1 and thread_id=''981111).

From where does this type=1 come??????/


also is there any way to delete SMS from the inbox.

please help
stilwalli
Developer
Developer
 
Posts: 35
Joined: Mon Jul 21, 2008 8:13 am

SMS

Postby stilwalli » Wed Oct 15, 2008 3:19 pm

System.out.println(Uri.parse("content://sms/inbox"));
c = context.getContentResolver().query(Uri.parse("content://sms/inbox"), null ,null, null, null);
System.out.println(c.getCount() + "");
/////////////Works ............................1
System.out.println(Uri.parse("content://sms/inbox/1"));
c = context.getContentResolver().query(Uri.parse("content://sms/inbox/1"), null ,null, null, null);
System.out.println(c.getCount() + "");
/////////////Works ..................................2

context.getContentResolver().delete(Uri.parse("content://sms/inbox/1"), null, null);
/////////////Does not work ..............Why??? ..........2 works then why does'nt this work.
I get IllegalArgumentException : Unknown URL.

pLEASE HELP
stilwalli
Developer
Developer
 
Posts: 35
Joined: Mon Jul 21, 2008 8:13 am

Postby soniya » Sat Oct 18, 2008 1:56 pm

:cry:
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby Hex » Sun Nov 16, 2008 3:19 pm

test on sdk1.0_r1

first you need "android.permission.READ_SMS","android.permission.WRITE_SMS" permission.

delete sms URI is "content://sms/conversations/_id"

_id do not manual input.

you can using
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.        Cursor c = mContext.getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);
  3.  
  4.         while (c.moveToNext()) {
  5.  
  6.                         try {
  7.  
  8.                                 String pid = c.getString(1);
  9.  
  10.                                 String uri = "content://sms/conversations/" + pid;
  11.  
  12.                                 mContext.getContentResolver().delete(Uri.parse(uri), null, null);
  13.  
  14.                         } catch (Exception e) {
  15.  
  16.                                 Log.v(TAG, e.getMessage());
  17.  
  18.                         }
  19.  
  20.                 }
  21.  
  22.  
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


sorry, my english is poor. :oops:

.
Hex
Freshman
Freshman
 
Posts: 4
Joined: Sun Oct 19, 2008 3:13 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 21 guests