没有合适的资源?快使用搜索试试~ 我知道了~
首页详解Android短信的发送和广播接收实现短信的监听
本文介绍了Android短信的发送和广播接收者实现短信的监听,要注意Android清单中权限的设置以及广播的注册监听实现,废话不多说,代码如下: 以下就是 Android清单的XML AndroidManifest.xml <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.zyw.broadcastsendsms android:versionCode=1 android:versionName=1.0> <uses-sdk android:
资源详情
资源评论
资源推荐

详解详解Android短信的发送和广播接收实现短信的监听短信的发送和广播接收实现短信的监听
本文介绍了Android短信的发送和广播接收者实现短信的监听,要注意Android清单中权限的设置以及广播的注册监听实现,废
话不多说,代码如下:
以下就是 Android清单的XML
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zyw.broadcastsendsms"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SendSMS"
android:label="@string/title_activity_send_sms" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".SMSBroadcastReceiver">
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission><!--添加权限-->
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
</manifest>
发送短息的主界面mian.xml和实现Activity SendSMS.java
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10sp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="手机号码" />
<EditText
android:id="@+id/Number"
android:numeric="integer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入电话号码" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="短信内容" />















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0