Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For an android specific solution you can use the <a href="http://developer.android.com/reference/android/telephony/SmsManager.html" rel="nofollow noreferrer">SmsManager</a> class. Here is some example code taken from a <a href="https://stackoverflow.com/questions/3995541/sms-manager-in-android">similar question</a> that deals with sending an sms message from an android application.</p> <p>Have a look at <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/os/SmsMessagingDemo.html" rel="nofollow noreferrer">SmsMessagingDemo</a> from the android development API demo page. Below is a snippet of the sending code.</p> <pre><code> // Watch for send button clicks and send text messages. Button sendButton = (Button) findViewById(R.id.sms_send_message); sendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (TextUtils.isEmpty(recipientTextEdit.getText())) { Toast.makeText(SmsMessagingDemo.this, "Please enter a message recipient.", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(contentTextEdit.getText())) { Toast.makeText(SmsMessagingDemo.this, "Please enter a message body.", Toast.LENGTH_SHORT).show(); return; } recipientTextEdit.setEnabled(false); contentTextEdit.setEnabled(false); SmsManager sms = SmsManager.getDefault(); List&lt;String&gt; messages = sms.divideMessage(contentTextEdit.getText().toString()); String recipient = recipientTextEdit.getText().toString(); for (String message : messages) { sms.sendTextMessage(recipient, null, message, PendingIntent.getBroadcast( SmsMessagingDemo.this, 0, new Intent(ACTION_SMS_SENT), 0), null); } } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload