I'm developing an application for school teachers. I want it to send SMS to all the parents. So I want to send SMS to non-Android devices also (i.e. Android application to any other device which may not have Internet also).
If possible, please give me the solution. This is what I have so far:
public class SendSMSActivity extends Activity {
Button buttonSend;
EditText textPhoneNo;
EditText textSMS;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonSend = (Button) findViewById(R.id.buttonSend);
textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
textSMS = (EditText) findViewById(R.id.editTextSMS);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//
// String phoneNo = textPhoneNo.getText().toString();
// String sms = textSMS.getText().toString();
//
// try {
// SmsManager smsManager = SmsManager.getDefault();
// smsManager.sendTextMessage(phoneNo, null, sms, null, null);
// Toast.makeText(getApplicationContext(), "SMS Sent!",
// Toast.LENGTH_LONG).show();
// } catch (Exception e) {
// Toast.makeText(getApplicationContext(),
// "SMS faild, please try again later!",
// Toast.LENGTH_LONG).show();
// e.printStackTrace();
// }
String number = "9940571282";
String message = "hi there";
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + number ) );
intent.putExtra( "sms_body", message );
startActivity( intent );
}
});
}
}