利用smsmanager实现后台发送短信示例
更新时间:2014年01月11日 15:53:41 作者:
这篇文章主要介绍了android利用SmsManager可以实现后台发送短信的方法,最近有使用说明,大家可以参考使用
复制代码 代码如下:
public void sendServiceSms(Context mContext,String content) {
try {
SmsManager manager = SmsManager.getDefault();
PendingIntent sentIntent = PendingIntent.getBroadcast(mContext, 0,
new Intent(SMS_SENT_TEST_ACTION), 0);
manager.sendTextMessage("13912345670", null, content, sentIntent, null);
} catch (Exception e) {
e.printStackTrace();
}
}
参数说明
sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent):
destinationAddress:接收方的手机号码
scAddress:发送方的手机号码
text:信息内容
sentIntent:发送是否成功的回执,
DeliveryIntent:接收是否成功的回执。
相关文章
Android开发中用Kotlin编写LiveData组件教程
LiveData是Jetpack组件的一部分,更多的时候是搭配ViewModel来使用,相对于Observable,LiveData的最大优势是其具有生命感知的,换句话说,LiveData可以保证只有在组件( Activity、Fragment、Service)处于活动生命周期状态的时候才会更新数据2022-12-12
基于Android week view仿小米和iphone日历效果
这篇文章主要为大家详细介绍了基于Android week view仿小米和iphone日历效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2017-11-11
Android 复制文本内容到系统剪贴板的最简单实例(分享)
下面小编就为大家带来一篇Android 复制文本内容到系统剪贴板的最简单实例(分享)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-04-04
Android Zipalign工具优化Android APK应用
本文主要介绍Android Zipalign工具优化Android APK应用,这里整理了相关资料及简单优化实例,有需要的小伙伴可以参考下2016-09-09


最新评论