In my Application
I'm sending text sms using SMS Manager
. To check whether messages is sent or not I'm using Toast
.
Instead of Toast
I want to get SMS Delivery Report
.I am trying many examples but, one flow not displaying delivery report like if my balance is 0 when SMS sending in my code I want to find SMS sending failed delivery report when my balance is 0.
Code:
String phoneNo = phno.getText().toString();
String smsBody = body.getText().toString();
//Selected Messages to report to 1909
{
try
{
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, smsBody, null, null);
Toast.makeText(getApplicationContext(), "SMS Sent to: "+phoneNo,Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
//Error Occurred if No Messages Selected
Toast.makeText(getApplicationContext(),"SMS failed, please try again later!",Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
}