send SMS via SmsManager - Android android.telephony

Android examples for android.telephony:SmsManager

Description

send SMS via SmsManager

Demo Code

import java.util.List;

import android.content.Context;
import android.telephony.SmsManager;

public class Main {

  public static void sendSMS(Context context, String cellphone, String content) {
    SmsManager smsManager = SmsManager.getDefault();

    List<String> texts = smsManager.divideMessage(content);
    for (int i = 0; i < texts.size(); i++) {
      String text = texts.get(i);
      smsManager.sendTextMessage(cellphone, null, text, null, null);
    }//from   w ww  .ja v a2 s .  c o  m
  }

}

Related Tutorials