Skip to content

Instantly share code, notes, and snippets.

@ludovicfrin
Last active February 1, 2016 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ludovicfrin/bee1ebc597d77d043369 to your computer and use it in GitHub Desktop.
Save ludovicfrin/bee1ebc597d77d043369 to your computer and use it in GitHub Desktop.
Envoi d'un SMS sous Android
public class SendSmsActivity extends AppCompatActivity {
...
private void sendSms(String recipient, String message) {
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(recipient, null, message, null, null);
} catch (Exceptione e) {
e.printStackTrace();
}
}
...
<uses-permission android:name="android.permission.SEND_SMS" />
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment