Hi,

I want to Delete SMS how i can delete it programmatically?
I am receiving sms in my application in this format string. "12345
username password"
******************************
i have post this thread on so many groups and forums but i dont receive any
reply from last one week.
its very urgent for our product. so i am sending this mail  to all of you.
*******************************************************************
public void onReceive(Context context, Intent intent) {

               if(!intent.getAction().equals
("android.provider.Telephony.SMS_RECEIVED"))
                       {
                               return;
                       }
                       SmsMessage smsMsg[] =
getMessagesFromIntent(intent);// here getting sms successfully

                       for(int i=0; i < smsMsg.length; i++)
                       {
                               receivedSMS =
smsMsg[i].getDisplayMessageBody();
                               if(receivedSMS.startsWith("12345"))
                                 {
                                         String[] dataArray =
MyUtility.breakIntoLines(receivedSMS, '
');
                                         String userName = dataArray[1];
                                         String userPassword = dataArray[2];

 this.updateUsernamePassword(context, userName, userPassword );//here saving
data successfully
                                         Toast.makeText(context,"Settings
saved", Toast.LENGTH_LONG).show
();

                                     try{
                                                 ***********************here
i want to delete that perticullar sms ***************
                                                 Uri uriSms =
Uri.parse("content://sms/inbox");
                                                  Cursor c =
context.getContentResolver().query(uriSms, null,null,null,null);
                                                int thread_id =c.getCount();
//get the thread_id

context.getContentResolver().delete(Uri.parse("content://sms/conversations/"+thread_id
),null,null);

                      }catch(Exception e)
                        {
                            Log.i("exception ",e.getMessage());
                        }

                                           }
                                 }

                   }

          }


after getting my required
data i want to delete this currently received sms programmatically.
data is very confidential in this sms and i want to delete it here
after getting data and also clear it from notification bar.or i want to
discard it because i dont want to show it in inbox
any one can help me regarding this.can any one give me code snippet
which was working perfectly for deleting sms or discarding it.

Thanks & Regards,
Gulfam

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to