rajdeokumarsingh / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

Deleting SMS... #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I cannot delete SMS messages.  I do not get an ID back so I cannot call 
deleteMessage.  Does anyone have a sample of how to delete a message?  I have 
pulled the code from SVN and built it so I think I have the latest code but not 
100% sure.  

Here is my code which prints out the ID which is blank and the toString which 
also show the id is blank:
public void dumpSMS() throws IOException{
        //Voice v = IS DEFINED GLOBALLY
        String smsstr = v.getSMS();
        System.out.println(smsstr);
        Collection<SMSThread> sms = v.getSMSThreads();
        for (SMSThread s : sms){
        System.out.println("New Thread...." + s.getId());
            for (SMS sm : s.getAllSMS()){
        System.out.println(sm.getFrom().getId() + " " +       sm.getFrom().getName() + " " + sm.getFrom().getNumber() + " " + sm.getContent() + " " + sm.getDateTime().toString());
                System.out.println(sm.toString());
                System.out.println("********** NO ID RETURNED**************");
                //HOW WOULD I DELETE THIS MESSAGE?
            }
        }   
    }

Here is the results:

https://www.google.com/voice/b/0/inbox/recent/sms/ - OK
New Thread....b5f1549cdfc63342be5ffeedb28477fbb7c0ba19
 +16822344100 +16822344100 TEST 1 3 Tue Mar 06 13:39:00 CST 2012
SMS [dateTime=Tue Mar 06 13:39:00 CST 2012, 
from={id=;name=+16822348100;number=+16822348100;imageUrl=http://www.google.com/v
oice/resources/1366864992-blue_ghost.jpg;}, text=TEST 1 3]
********** NO ID RETURNED**************

Thanks!

BBB

Original issue reported on code.google.com by buil...@bobblair.com on 6 Mar 2012 at 7:46

GoogleCodeExporter commented 8 years ago
Hi BBB,
This could be better documented in the Wiki, and I noticed the JavaDoc is not 
displaying properly as HTML. (Oh My!!)

Google Voice is big about the Conversation or SMSThread as we have named it.  I 
do not think it is even possible to delete a specific message out of a 
conversation or SMSThread, you have to delete the whole thing.  

N.B. when we say delete, we are talking about moving it to the Trash.  To 
really delete it you have to empty the trash.

This code should give you the hint you need:

    SMSThread smsthread = ....

    String msgID = smsthread.getId();
    try {
         voice.deleteMessage(msgID);
    } catch (IOException e) {
         e.printStackTrace();
    }

Original comment by malone.j...@gmail.com on 6 Mar 2012 at 10:49

GoogleCodeExporter commented 8 years ago
Thanks!  That's the problem.  I have to delete the whole thing and there is 
an ID for the  thread.  Perfect!

Original comment by buil...@bobblair.com on 6 Mar 2012 at 11:13

GoogleCodeExporter commented 8 years ago
hello to everybody over there 

Original comment by hotlyja...@gmail.com on 27 Feb 2014 at 12:02