Android 运行应用程序Log时未调用Broadcastreceiver()的onReceiver()方法

Android 运行应用程序Log时未调用Broadcastreceiver()的onReceiver()方法,android,Android,onreceiver()运行应用程序日志时未调用Broadcastreceiver的方法。d()未在日志中显示 -清单文件如下 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.Audio.audioplayer" android:versionCode="1" a

onreceiver()
运行应用程序日志时未调用Broadcastreceiver的方法。d()未在日志中显示 -清单文件如下

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.Audio.audioplayer"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <receiver 
            android:name=".MyReceiver">
         <intent-filter>
          <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />

       </intent-filter>
    </receiver>
        <activity
            android:name="com.Audio.audioplayer.PlayerAudioActivity"
            android:label="@string/app_name" 
            android:screenOrientation="portrait"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <data android:scheme="tel" />
            </intent-filter>
        </activity>
        <activity
            android:name=".PlayListActivity"
            android:label="@string/app_name" 
            android:screenOrientation="portrait" 
            >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.Audio.audioplayer.PlayerAudioActivity" />

        </activity>
    </application>

</manifest>

BootReceiver在系统发生更改时工作,就像在设备中连接和断开网络时工作一样

试试这个

 <receiver android:name=".MyReceiver" android:enabled="true">

 <intent-filter>        
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/><action   
android:name="android.net.conn.CONNECTIVITY_CHANGE"/><action  
android:name="android.net.conn.DATA_ACTIVITY_CHANGE"/>
</intent-filter>
</receiver>


当你想启动BootReceiver我不明白你在说什么BootReceiver我不知道当系统发生变化时,该选项会起作用,就像这样当你在设备中连接和断开网络时,该选项会在设备设置中关闭wifi,然后查看logcatI已关闭但对输出没有影响我正在使用手机作为仿真器,正如你告诉我的,我关闭了wifi,但logCat文件中没有log.d的结果
 <receiver android:name=".MyReceiver" android:enabled="true">

 <intent-filter>        
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/><action   
android:name="android.net.conn.CONNECTIVITY_CHANGE"/><action  
android:name="android.net.conn.DATA_ACTIVITY_CHANGE"/>
</intent-filter>
</receiver>