当前位置:首页 » 安卓系统 » android发送短信

android发送短信

发布时间: 2022-01-09 20:03:54

A. intent激活Android自带的短信系统,发送短信

//取得一个默认实例的SmsManager
SmsManager sm=SmsManager.getDefault();
if(isPhoneNumberValid(s01)&&isWithin70(s02)){
/**
* 当两个判定条件都通过时发送短信,先构建一个PendingIntent对象并使用getBroadcast()广播
* 然后将PendingIntent,短信,电话号码等内容传入SmsManager的sendTextMessage()方法中*/
try {
PendingIntent pi=PendingIntent.getBroadcast(myActivity.this, 0, new Intent(), 0);
sm.sendTextMessage(s01, null, s02, pi, null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
以上,题主可以参考下,传入的参数有不懂的,可以看下API介绍。

B. 怎么判断android 短信发送是否成功

若使用的是vivo手机,未发送成功的短信,会显示红色感叹号,已发送成功的短信则不显示感叹号,还可以进入设置--应用与权限--系统应用设置--信息--打开短彩信送达报告,开启后已送达的短信前面显示箭头。

C. android 发送长短信怎么实现

源码SmsManager类里有个方法可以用来发送长短信,代码如下:
public void sendMultipartTextMessage(
String destinationAddress, String scAddress, ArrayList<String> parts,
ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
if (TextUtils.isEmpty(destinationAddress)) {
throw new IllegalArgumentException("Invalid destinationAddress");
}
if (parts == null || parts.size() < 1) {
throw new IllegalArgumentException("Invalid message body");
}

if (parts.size() > 1) {
try {
ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
if (iccISms != null) {
iccISms.sendMultipartText(destinationAddress, scAddress, parts,
sentIntents, deliveryIntents);
}
} catch (RemoteException ex) {
// ignore it
}
} else {
PendingIntent sentIntent = null;
PendingIntent deliveryIntent = null;
if (sentIntents != null && sentIntents.size() > 0) {
sentIntent = sentIntents.get(0);
}
if (deliveryIntents != null && deliveryIntents.size() > 0) {
deliveryIntent = deliveryIntents.get(0);
}
sendTextMessage(destinationAddress, scAddress, parts.get(0),
sentIntent, deliveryIntent);
}
}

D. android,如何拦截发送短信

您好,目前的手机安全软件有提供“举报”、“标记”诈骗电话、诈骗信息的功能,腾讯手机管家诚邀您来标记,您的一人举报/标记,可让上亿用户受益,同时他人的标记,也可让您避免上当受骗。操作方法如下。

1、安装腾讯手机管家并开启,管家就会自动实现对“响一声电话”、“常见诈骗短信”进行拦截,并提示您可进行标记。

2、拦截后,只需通过“安全防护”中的“骚扰拦截”功能,就可查看拦截电话记录。

以上为遇到诈骗短信及诈骗电话时的操作介绍,腾讯手机管家欢迎您进行体验。

E. Android开发中如何调用发短信功能 详细�0�3

首先,应该在程序清单文件AndroidManifest.xml 中加入发短信的权限图 1图1 为发短信的简要界面
包括两个TextView 组件,两个EditText 组件,一个Button 组件,在主程序为发送
按钮增加单击事件
private EditText txt_num;
private EditText txt_content;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt_num= (EditText) this.findViewById(R.id.txt_num);
txt_content=(EditText) this.findViewById(R.id.txt_content);
Button btn_send = (Button) this.findViewById(R.id.btn_send);
btn_send.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String str_num = txt_num.getText().toString();//得到电话号码
String str_content = txt_content.getText().toString();//得到短信内容
SmsManager manager_sms = SmsManager.getDefault();//得到短信管理器
//由于短信可能较长,故将短信拆分ArrayListtexts =smsManager.divideMessage(str_content);
for(String text : texts){
smsManager.sendTextMessage(str_num, null, text, null, null);//分别发送每一条短信}Toast.makeText(SMSActivity.this, "发送成功!", Toast.LENGTH_LONG).show();//提示成功}});}
至此,发送短信功能介绍完毕

F. android 开发 一个通过服务端内容自动发送短信到指定号码

服务器和手机端通信,如果要实时通信,就需要使用推送,自己写的推送一般不够好,还是使用专业推送比较好,国内的可以使用极光推送,网络推送等等,如果是国际的可以使用谷歌的google cloud message,或者使用友盟……友盟还是比较靠谱的。

然后手机发送短信只需要一个权限,然后会有很简单的代码就可以发送短信了,而且,一般的第三发推送也可以给服务端发消息,所以你的要求就齐全了。

如果不是用第三方的向服务器报告,也可以自己写和服务器的通信。

如果推送都要自己写,那么android的推送有3种方式,第一socket长连接,比较耗费手机资源和电……第二种轮询,有一点点延迟,看你的实时性有多高……第三种,使用短信息,服务端要有短信网关,手机端则监听手机短信数据库,用这个的比较少,一般长连接比较多。

我的号码就是我qq,有什么问题可以进一步的问我,或者我没时间的话也有很多android开发群 可以介绍给你 随便问问题,有很多高人解答

G. 怎么给android 加入发送免费短信功能

首先,应该在程序清单文件AndroidManifest.xml中加入发短信的权限
<uses-permission android:name="android.permission.SEND_SMS"/>
包括两个TextView组件,两个EditText组件,一个Button组件,在主程序为发送按钮增加单击事件
private EditText txt_num;
private EditText txt_content;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt_num= (EditText) this.findViewById(R.id.txt_num);
txt_content=(EditText) this.findViewById(R.id.txt_content);
Button btn_send = (Button) this.findViewById(R.id.btn_send);
btn_send.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String str_num = txt_num.getText().toString();//得到电话号码
String str_content = txt_content.getText().toString();//得到短信内容
SmsManager manager_sms = SmsManager.getDefault();//得到短信管理器
//由于短信可能较长,故将短信拆分
ArrayList<String> texts = smsManager.divideMessage(str_content);
for(String text : texts){
smsManager.sendTextMessage(str_num, null, text, null, null);//分别发送每一条短信
}
Toast.makeText(SMSActivity.this, "发送成功!", Toast.LENGTH_LONG).show();//提示成功
}
});
}
至此,发送短信功能介绍完毕

H. android发送短信带监听是否发送成功功能

如何判断android 短信发送(sendTextMessage)是否成功
//短信发送API说明

[java] view plainprint?

SmsManager smsManager = SmsManager.getDefault();

smsManager.sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent);

/**

* 参数说明

* destinationAddress:收信人的手机号码

* scAddress:发信人的手机号码

* text:发送信息的内容

* sentIntent:发送是否成功的回执,用于监听短信是否发送成功。

* DeliveryIntent:接收是否成功的回执,用于监听短信对方是否接收成功。

*/

I. 如何给android模拟器发送短信

工具/原料

Eclipse开发平台
Android SDK
与Eclipse和Android SDK版本相对应的ADT
方法/步骤

启动Eclipse,并配置Android模拟器。右键你的Project -->Run As -->Run Configuratios -->如下图-->然后点击RUN(运行)。选择所要使用的模拟器。

打开DDMS(Dalvik Debug Monitor Service)

打开Emulator Control,进入Emulator Control界面。

在Emulator Control界面中输入要发送短信的手机号码,这里为模拟器的号码。模拟器的号码查看方法如图所示。

选择短信模式并编辑短信

接收短信并验证短信内容

热点内容
p搜系统只缓存1页为什么 发布:2024-09-20 16:48:51 浏览:838
上网的账号和密码是什么东西 发布:2024-09-20 16:31:31 浏览:612
安卓手机王者荣耀如何调超高视距 发布:2024-09-20 16:31:30 浏览:428
安卓G是什么app 发布:2024-09-20 16:23:09 浏览:81
iphone怎么压缩文件 发布:2024-09-20 16:08:18 浏览:356
linux查看用户名密码是什么 发布:2024-09-20 16:03:20 浏览:744
mac执行python脚本 发布:2024-09-20 15:58:52 浏览:779
单片机android 发布:2024-09-20 09:07:24 浏览:765
如何提高三星a7安卓版本 发布:2024-09-20 08:42:35 浏览:664
如何更换服务器网站 发布:2024-09-20 08:42:34 浏览:311