Java 类android.telephony.gsm.SmsManager 实例源码

项目:sagesmobile-mReceive    文件:SmsForwardReceiver.java   
@Override
public void onReceive(Context context, Intent intent) {
    if (!intent.getAction().equals("org.rapidandroid.intents.SMS_FORWARD")) {
        throw new RuntimeException();
    }
    SmsManager smgr = SmsManager.getDefault();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        Log.d(this.getClass().getName(), "SMS forwarding in progress");
        String mesg = extras.getString("msg");
        String[] fwdnums = extras.getStringArray("forwardNums");
        for (String destinationAddr : fwdnums) {
            // String destinationAddr = extras.getString(KEY_DESTINATION_PHONE);
            // String mesg = extras.getString(KEY_MESSAGE);
            smgr.sendTextMessage(destinationAddr, null, mesg, null, null);
        }
        Log.d(this.getClass().getName(), "SMS forwarding complete");
    }

}
项目:buildAPKsApps    文件:BarrageService.java   
@Override
public void onCreate() {
    HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();

    mServiceLooper = thread.getLooper();
    mServiceHandler = new ServiceHandler(mServiceLooper);

    mSmsManager = SmsManager.getDefault();
}
项目:alternate-java-bridge-library    文件:Textingsvc.java   
/**
 * Creates a new TextMessage component.
 *
 * @param container  ignored (because this is a non-visible component)
 */
public Textingsvc(SvcComponentContainer container) {
  super(container.$formService());
  IntentFilter intentFilter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
  container.$context().registerReceiver(receiver, intentFilter);
  Log.d("Simple", "Texting constructor");
  smsManager = SmsManager.getDefault();
  PhoneNumber("");
  receivingEnabled = true;
  formService.registerForOnStartCommand(this);
  formService.registerForOnDestroy(this);
}
项目:sagesmobile-mReceive    文件:SmsReplyReceiver.java   
@Override
public void onReceive(Context context, Intent intent) {
    SmsManager smgr = SmsManager.getDefault();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        if (extras.containsKey(KEY_DESTINATION_PHONE) && extras.containsKey(KEY_MESSAGE)) {
            String destinationAddr = extras.getString(KEY_DESTINATION_PHONE);
            String mesg = extras.getString(KEY_MESSAGE);
            /** TODO if mesg.length > 160(i think?) chars then this throws exception. would need
             * to use the version that sends segmented sms **/
            smgr.sendTextMessage(destinationAddr, null, mesg, null, null);
        }
    }
}
项目:prey-android-client-master    文件:CupcakeSupport.java   
public static void sendSMS(String destSMS, String message) {
    SmsManager sm = SmsManager.getDefault();
    sm.sendTextMessage(destSMS, null, message, null, null);

}
项目:cudl-prototype    文件:SmsSend.java   
public void sayHello(View v) {

    String _messageNumber="+447933037883";
    String messageText = "";

    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(_messageNumber, null, messageText, null, null);

}