android - how to send multiple sms to one recepient only on a button click? -


i need create application wherein on single button click want send multiple sms particular number , capture delivery reports , store in database , show in app in listview. messages sent physically not typed user instead comes database.

how acheive functionality?? please help!

thanks in advance!

broadcastreceiver sendbroadcastreceiver = new sentreceiver();     broadcastreceiver deliverybroadcastreciever = new deliverreceiver();;      @override     protected void onpause() {         // todo auto-generated method stub         super.onpause();          try {             unregisterreceiver(sendbroadcastreceiver);             unregisterreceiver(deliverybroadcastreciever);         } catch (exception e) {             // todo auto-generated catch block             e.printstacktrace();         }     } @override protected void ondestroy() {     // todo auto-generated method stub     super.ondestroy();     try {         unregisterreceiver(sendbroadcastreceiver);         unregisterreceiver(deliverybroadcastreciever);     } catch (exception e) {         // todo auto-generated catch block         e.printstacktrace();     } }      send_sms.setonclicklistener(new onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 if (textview.gettext().tostring().equals("")                         | textview.gettext().tostring().equals(null)) {                     toast.maketext(sendsms.this, enter_ph_no, toast.length_long)                             .show();                 } else {                           sendsms(textview.gettext().tostring(), "sms_content");                         **//call line multiple times**                   }              }         }); private void sendsms(string phonenumber, string message) {         string sent = "sms_sent";         string delivered = "sms_delivered";          pendingintent sentpi = pendingintent.getbroadcast(this, 0, new intent(                 sent), 0);          pendingintent deliveredpi = pendingintent.getbroadcast(this, 0,                 new intent(delivered), 0);          registerreceiver(sendbroadcastreceiver, new intentfilter(sent));          registerreceiver(deliverybroadcastreciever, new intentfilter(delivered));         smsmanager sms = smsmanager.getdefault();         sms.sendtextmessage(phonenumber, null, message, sentpi, deliveredpi);       }      class deliverreceiver extends broadcastreceiver {         @override         public void onreceive(context context, intent arg1) {             switch (getresultcode()) {             case activity.result_ok:                 toast.maketext(getbasecontext(), sms_delivered,                         toast.length_short).show();                 break;             case activity.result_canceled:                 toast.maketext(getbasecontext(), sms_not_delivered,                         toast.length_short).show();                 break;             }          }     }      class sentreceiver extends broadcastreceiver {         @override         public void onreceive(context context, intent arg1) {             switch (getresultcode()) {             case activity.result_ok:                 toast.maketext(getbasecontext(), sms_sent, toast.length_short)                         .show();                 startactivity(new intent(sendsms.this, chooseoption.class));                 overridependingtransition(r.anim.animation, r.anim.animation2);                 break;             case smsmanager.result_error_generic_failure:                 toast.maketext(getbasecontext(), "generic failure",                         toast.length_short).show();                 break;             case smsmanager.result_error_no_service:                 toast.maketext(getbasecontext(), "no service",                         toast.length_short).show();                 break;             case smsmanager.result_error_null_pdu:                 toast.maketext(getbasecontext(), "null pdu", toast.length_short)                         .show();                 break;             case smsmanager.result_error_radio_off:                 toast.maketext(getbasecontext(), "radio off",                         toast.length_short).show();                 break;             }          }     } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -