全屏模式下接收系统信息(短信)

来源:互联网 发布:手机安装ubuntu系统 编辑:程序博客网 时间:2024/05/17 07:05
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
        <activity            android:name="org.gentry.videoplayer.MainActivity"            android:label="@string/app_name"            android:screenOrientation="landscape"            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <!-- 设置广播接受者,关心短信到来的广播事件 -->        <receiver android:name=".SmsReceiver" >            <intent-filter>                <action android:name="android.provider.Telephony.SMS_RECEIVED" />            </intent-filter>        </receiver>
package org.gentry.videoplayer;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.widget.Toast;public class SmsReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {Toast.makeText(context, "短信来了。。", Toast.LENGTH_SHORT).show();}}



0 0
原创粉丝点击