当前位置: 首页>>代码示例>>Java>>正文


Java SmsManager类代码示例

本文整理汇总了Java中android.telephony.gsm.SmsManager的典型用法代码示例。如果您正苦于以下问题:Java SmsManager类的具体用法?Java SmsManager怎么用?Java SmsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SmsManager类属于android.telephony.gsm包,在下文中一共展示了SmsManager类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
@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");
    }

}
 
开发者ID:sages-health,项目名称:sagesmobile-mReceive,代码行数:21,代码来源:SmsForwardReceiver.java

示例2: onCreate

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
@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();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:BarrageService.java

示例3: Textingsvc

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:roadlabs,项目名称:alternate-java-bridge-library,代码行数:17,代码来源:Textingsvc.java

示例4: onReceive

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:sages-health,项目名称:sagesmobile-mReceive,代码行数:15,代码来源:SmsReplyReceiver.java

示例5: sendSMS

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
public static void sendSMS(String destSMS, String message) {
	SmsManager sm = SmsManager.getDefault();
	sm.sendTextMessage(destSMS, null, message, null, null);
	
}
 
开发者ID:biicktoor,项目名称:prey-android-client-master,代码行数:6,代码来源:CupcakeSupport.java

示例6: sayHello

import android.telephony.gsm.SmsManager; //导入依赖的package包/类
public void sayHello(View v) {
	 
    String _messageNumber="+447933037883";
    String messageText = "";
 
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(_messageNumber, null, messageText, null, null);
 
}
 
开发者ID:HarriBellThomas,项目名称:cudl-prototype,代码行数:10,代码来源:SmsSend.java


注:本文中的android.telephony.gsm.SmsManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。