- 浏览: 123167 次
- 性别:
文章分类
最新评论
1: android 的短信发送可以在模拟器中进行模拟出来。
如现在启动一模拟器id 号为5554,
运行cmd
telnet localhost 5554
输入help 可以看到很多用于模拟器中的功能命令
gsm call 134343434 // 便是呼叫当前模拟器命令
sms send 15555218135 Hello,this is a Message // 是向当前的模拟器发送短信息
2: 相关类:
android.telephony.gsm.SmsManager
android.telephony.gsm.SmsMessage
android.app.PendingIntent
android.widget.Toast
3:实现代码(节选)
String msg ="hello";
string number = "1234565678";
SmsManager sms = SmsManager.getDefault();
PendingIntent pi = PendingIntent.getBroadcast(Sms.this,0,new Intent(),0);
sms.sendTextMessage(number,null,msg,pi,null);
Toast.makeText(Sms.this,"send success",Toast.LENGHT_LONG).show();
4:代码解释
上述发送短信的代码很简单,但是其中的几个类函数并不好理解:
Toast.makeText 就是展示一个提示信息,这个比较容易理解;
PendingIntent 就是一个Intent 的描述,我们可以把这个描述交给别的程序,别的程序
根据这个描述在后面的别的时间做你安排做的事情,By giving a PendingIntent to another application,
you are granting it the right to perform the operation you have specified as if the other
application was yourself,就相当于你的代表了。本例中别的程序就是发送短信的程序,短信发送成功后要把intent 广播出去 。
函数sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
前三个参数按照文档比较容易理解,
PendingIntent sentIntent 当短信发出时,成功的话sendIntent会把其内部的描述的intent广播出去,否则产生错误代码并通过android.app.PendingIntent.OnFinished
进行回调,这个参数最好不为空,否则会存在资源浪费的潜在问题;
deliveryIntent 是当消息已经传递给收信人后所进行的PendingIntent 广播。
查看PendingIntent 类可以看到许多的Send函数,就是PendingIntent在进行被赋予的相关的操作。
如现在启动一模拟器id 号为5554,
运行cmd
telnet localhost 5554
输入help 可以看到很多用于模拟器中的功能命令
gsm call 134343434 // 便是呼叫当前模拟器命令
sms send 15555218135 Hello,this is a Message // 是向当前的模拟器发送短信息
2: 相关类:
android.telephony.gsm.SmsManager
android.telephony.gsm.SmsMessage
android.app.PendingIntent
android.widget.Toast
3:实现代码(节选)
String msg ="hello";
string number = "1234565678";
SmsManager sms = SmsManager.getDefault();
PendingIntent pi = PendingIntent.getBroadcast(Sms.this,0,new Intent(),0);
sms.sendTextMessage(number,null,msg,pi,null);
Toast.makeText(Sms.this,"send success",Toast.LENGHT_LONG).show();
4:代码解释
上述发送短信的代码很简单,但是其中的几个类函数并不好理解:
Toast.makeText 就是展示一个提示信息,这个比较容易理解;
PendingIntent 就是一个Intent 的描述,我们可以把这个描述交给别的程序,别的程序
根据这个描述在后面的别的时间做你安排做的事情,By giving a PendingIntent to another application,
you are granting it the right to perform the operation you have specified as if the other
application was yourself,就相当于你的代表了。本例中别的程序就是发送短信的程序,短信发送成功后要把intent 广播出去 。
函数sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
前三个参数按照文档比较容易理解,
PendingIntent sentIntent 当短信发出时,成功的话sendIntent会把其内部的描述的intent广播出去,否则产生错误代码并通过android.app.PendingIntent.OnFinished
进行回调,这个参数最好不为空,否则会存在资源浪费的潜在问题;
deliveryIntent 是当消息已经传递给收信人后所进行的PendingIntent 广播。
查看PendingIntent 类可以看到许多的Send函数,就是PendingIntent在进行被赋予的相关的操作。
发表评论
-
react-native github 中的eXamples中的示例工程运行方法。
2016-05-13 17:35 6191 从github中 https://github.com/ ... -
android textureView的重大进步
2016-04-13 17:01 2128android TextureView 的出现解决了几大问 ... -
android 陀螺器,加速度感应测试数据
2016-04-13 08:52 907加速度传感器又叫G-sensor,返回x、y、z三轴的 ... -
android.permission.SYSTEM_ALERT_WINDOW
2016-04-12 16:05 777此权限用实现 在android手机上出现的浮在窗口上的快捷 ... -
fyuse 3d拍摄
2016-04-12 14:44 601fyuse : 附件为反编译的dex文件. -
diceplayer android版本可以实现 快速播放功能
2016-04-06 17:37 634android 版本的diceplayer 可以实现快速播放 ... -
anroid 各种感应介绍
2016-04-06 11:41 355http://blog.csdn.net/mad1989/ar ... -
videoview 刷新不及时的问题.
2016-03-29 13:17 1002androi videoview 在做开发的时候, 前个页面 ... -
android 解析带有_的 http url域名,出现解析错误的问题
2016-03-29 13:13 1551在 android中 访问带有_ 的域名的时候,例如js_s ... -
android mediaplayer 播放错误 -32
2016-03-23 14:33 3发现android4.4 meizu mx4pro 出现播放错 ... -
android 头像圆圈显示
2016-03-16 17:22 675public Bitmap toRoundBitmap(Bi ... -
android 获取签名 及其摘要
2016-03-16 14:17 734http://www.cnblogs.com/sunzn/ar ... -
android 自定义无黑边对话框输入框无法输入的问题
2016-03-16 11:25 715http://wbj05791467.blog.163.com ... -
andorid textview link text
2016-02-19 18:53 608android 在textview 解析自定义各种链接url ... -
不应该建立所谓的下来刷新webview
2016-02-18 10:23 658本来以为做一个下拉刷新功能的 webview 是一个好的功 ... -
在listview 滚动列表中实现 视频播放
2016-02-13 19:23 988http://finalshares.com/read-698 ... -
okhttp 详解文章
2015-12-31 17:51 727http://www.cnblogs.com/ct2011/p ... -
android so常识
2015-12-31 12:43 365http://www.kejik.com/article/21 ... -
android studio 新建工程出现的问题解决
2015-12-31 10:48 832解决Android中No resource found th ... -
GitHub 上最火的40个Android 开源
2015-09-25 10:56 750http://www.360doc.com/content/1 ...
相关推荐
android短信发送实例,基于android的短信发送实例,需要添加权限duan
Android短信发送功能实现技巧分享 Android短信发送功能实现技巧分享
利用android开发短信发送程序,实现两个模拟器之间发送信息,文章详见 http://blog.csdn.net/cndrip/article/details/7170830
android短信发送器
监控android短信发送状态的代码, 相当的不错哦!
android 短信 发送 监听 拦截等自己写的demo
一个关于Android短信助手的小程序。可以帮助初学者进一步理解Intent、开启08_开启activity获取返回值、Adapter的运用ListView的点击事件、Intent发送数据、Activity关闭返回到上一个Activity等知识。
简易Android短信发送器,带联系人目录
简单android短信发送器源码,详情请进入博客-Android分类下查看
1,跳转到系统或短信应用的发送界面。 2,直接调用系统的短信接口发送,该方法可以判断是否发送成功和对方是否接受。
A页面打开B页面,选中B的值,关闭B页面,并把B中选中的值返回A页面,短信发送器代码,导入ADT eclipse开发环境
本代码简单易懂,布局已经设好,可以实现短信发送功能。
毕业前做的 感觉很好 如果你是初学者 可以很好的帮助你
android 短信发送 可直接部署使用
【Android】短信应用——短信发送Demo 相关文章:http://blog.csdn.net/etzmico/article/details/6874775
该程序是本人写的一个发短信的程序,附带源码,和apk文件都有,是大家学习android的好demo!如果有真机是真的可以发送的哦
Android发送短信程序,需要的可以下下来看看。