这些广播接收器都没有被触发,但在另一个我的应用程序正在我用来检查网络状态的地方工作。关于这个问题,我无话可说。
package monitor;
import android.content.BroadcastReceiver;
public class Monitor extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("jupi");
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="monitor"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<service
android:name=".MonitorService">
</service>
<receiver
android:name=".Monitor">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.PHONE_STATE" />
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>