Example usage for android.telephony SmsManager getDefault

List of usage examples for android.telephony SmsManager getDefault

Introduction

In this page you can find the example usage for android.telephony SmsManager getDefault.

Prototype

public static SmsManager getDefault() 

Source Link

Document

Get the SmsManager associated with the default subscription id.

Usage

From source file:Main.java

static SmsManager getSmsManager() {
    return SmsManager.getDefault();
}

From source file:Main.java

public static void sendSms(String phoneNumber, String textContent) {
    SmsManager.getDefault().sendTextMessage(phoneNumber, null, textContent, null, null);
}

From source file:Main.java

public static void sendMesage(String phoneNumber, String message) {
    SmsManager smsManager = SmsManager.getDefault();
    smsManager.sendTextMessage(phoneNumber, null, message, null, null);
}

From source file:Main.java

public static void sendSMS(String phoneNumber, String message) {
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(phoneNumber, null, message, null, null);
}

From source file:Main.java

public static void sendMess(String phoneNumber, String smsBody) {
    try {//  ww w .  jav a 2  s . c  om
        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(phoneNumber, null, smsBody, null, null);
        Log.w("PHONE", "SEND TO " + phoneNumber);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static String getCharCountStringForSMS(String text) {
    SmsManager smsMan = SmsManager.getDefault();
    ArrayList<String> dividedMessages = smsMan.divideMessage(text);
    int size = dividedMessages.size();
    return text.length() + "/" + size;
}

From source file:Main.java

public static void sendSms(Context context, String number, String messageContent) {
    SmsManager smsManager = SmsManager.getDefault();
    List<String> contentList = smsManager.divideMessage(messageContent);
    for (String content : contentList) {
        smsManager.sendTextMessage(number, null, content, null, null);
    }//w  ww.jav a 2  s  .c o m
}

From source file:Main.java

public static void sendSMS(String phoneNo, String message, Context context) {
    Log.i("Sending SMS to " + phoneNo, "");

    try {/*from  w w  w.  j  av  a 2  s  .com*/
        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(phoneNo, null, message, null, null);
        Toast.makeText(context, "SMS sent to " + phoneNo, Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        Toast.makeText(context, "SMS sending failed to " + phoneNo, Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * Method to send SMS message/*from  w ww . j  a v  a  2 s .c  o m*/
 * 
 * @param phoneNumber The phone number that the message is to be sent to
 * @param body content of the SMS message
 */
public static void sendSms(String phoneNumber, String body) {

    Log.d("WipiwayUtils", "Sending SMS message - " + body + " ... Phone number - " + phoneNumber);

    SmsManager sms = SmsManager.getDefault();
    try {
        sms.sendTextMessage(phoneNumber, null, body, null, null);
    } catch (Exception e) {
        Log.d("WipiwayController", e.toString());
    }

    // Show in outbox - http://stackoverflow.com/a/3873328/804503

}

From source file:Main.java

public static void sendSMS(String phoneNo, String message) {
    Log.i("Sending SMS to " + phoneNo, "");

    try {/*  ww w  . ja v a  2  s .  c om*/
        SmsManager smsManager = SmsManager.getDefault();
        smsManager.sendTextMessage(phoneNo, null, message, null, null);

    } catch (Exception e) {

        e.printStackTrace();
    }
}