Send Multiple sms
-
Hi Experts How can i send multiple(different number) SMS through code? Code is here..
public class sms extends Activity {
private static final String View = null;
/** Called when the activity is first created. */
boolean b;public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);try {
sendSMS(Numbert, Message); Toast.makeText(sms.this, "SMS Sent", Toast.LENGTH\_LONG).show(); } catch (Exception e) { //Toast.makeText(sms.this, e.getMessage(),Toast.LENGTH\_LONG).show(); }
}
public void sendSMS(String number, String msg) throws Exception {
{
for(int i=0;i<10;i++)
{
SmsManager sms = SmsManager.getDefault();
TelephonyManager telemngr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);sms.sendTextMessage("01234555", null, "Test Message", null, null);
}
} -
Hi Experts How can i send multiple(different number) SMS through code? Code is here..
public class sms extends Activity {
private static final String View = null;
/** Called when the activity is first created. */
boolean b;public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);try {
sendSMS(Numbert, Message); Toast.makeText(sms.this, "SMS Sent", Toast.LENGTH\_LONG).show(); } catch (Exception e) { //Toast.makeText(sms.this, e.getMessage(),Toast.LENGTH\_LONG).show(); }
}
public void sendSMS(String number, String msg) throws Exception {
{
for(int i=0;i<10;i++)
{
SmsManager sms = SmsManager.getDefault();
TelephonyManager telemngr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);sms.sendTextMessage("01234555", null, "Test Message", null, null);
}
}What exactly you want.. you code already seen good, are you getting any error? :~
Pavan Pareta
-
What exactly you want.. you code already seen good, are you getting any error? :~
Pavan Pareta
Thanks for reply No i am not getting any error. But when i send message on more than one number,then some time code fail.I mean message not send successfully. So my question is that if my code is good then 1) Why not send successfully 100% 2) Or Any other option to send multiple sms
-
Hi Experts How can i send multiple(different number) SMS through code? Code is here..
public class sms extends Activity {
private static final String View = null;
/** Called when the activity is first created. */
boolean b;public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);try {
sendSMS(Numbert, Message); Toast.makeText(sms.this, "SMS Sent", Toast.LENGTH\_LONG).show(); } catch (Exception e) { //Toast.makeText(sms.this, e.getMessage(),Toast.LENGTH\_LONG).show(); }
}
public void sendSMS(String number, String msg) throws Exception {
{
for(int i=0;i<10;i++)
{
SmsManager sms = SmsManager.getDefault();
TelephonyManager telemngr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);sms.sendTextMessage("01234555", null, "Test Message", null, null);
}
}Are you sure you want to create SmsManager and TelephonyManager objects inside loop? Also, is it for android? If so, you can try to use sentIntent to check if sending was successfull or reason of failure for your messages.
-- "My software never has bugs. It just develops random features."
-
Are you sure you want to create SmsManager and TelephonyManager objects inside loop? Also, is it for android? If so, you can try to use sentIntent to check if sending was successfull or reason of failure for your messages.
-- "My software never has bugs. It just develops random features."
-
thanks for reply It doesn't matter for where i create SmsManager and TelephonyManager.I wont only one thing send sms 100% successfully from my side. If you have any idea then please give me tips or example Thanks in advance
MsmVc wrote:
one thing send sms 100% successfully from my side.
If you mean one single function call that will always work, then you can't do it. Using cellular communications inherently contains the possibility of failure due to glitches in signal strength, visibility of nodes, interference, ... The best you can do is put a reasonable number of retries in your code to handle the failure case. Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss. Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
-
MsmVc wrote:
one thing send sms 100% successfully from my side.
If you mean one single function call that will always work, then you can't do it. Using cellular communications inherently contains the possibility of failure due to glitches in signal strength, visibility of nodes, interference, ... The best you can do is put a reasonable number of retries in your code to handle the failure case. Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss. Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
-
MsmVc wrote:
one thing send sms 100% successfully from my side.
If you mean one single function call that will always work, then you can't do it. Using cellular communications inherently contains the possibility of failure due to glitches in signal strength, visibility of nodes, interference, ... The best you can do is put a reasonable number of retries in your code to handle the failure case. Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss. Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
-
use my previous suggestion to add some retries ... you had code in your very first post - simply check the return value and retry if it returns an error Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss. Lazarus Long, "Time Enough For Love" by Robert A. Heinlein