I have contact numbers in local JSON
file. And I have to send SMS by retrieving the contact number from JSON
. I have no idea how to make it work, please help me.
My JSON file:
{"Person Name": "abc", "Person Phone": "1234567890"}
Here is my method in which I am sending the SMS to fetched conrtact.
protected void sendsms(String Person_Phone,String message)
{
Toast.makeText(this, "sms sent to"+Person_Phone,Toast.LENGTH_SHORT).show();
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(Person_Phone, null, message, null, null);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "" + getString(R.string.smsfailed),Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}