Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我的BroadcastReceiver在我的N1引导之后没有接收到引导\u完成的意图_Android_Service_Broadcastreceiver_Android Intent_Intentfilter - Fatal编程技术网

Android 我的BroadcastReceiver在我的N1引导之后没有接收到引导\u完成的意图

Android 我的BroadcastReceiver在我的N1引导之后没有接收到引导\u完成的意图,android,service,broadcastreceiver,android-intent,intentfilter,Android,Service,Broadcastreceiver,Android Intent,Intentfilter,我无法使用BOOT_COMPLETED意图调用BroadcastReceiver onReceive方法 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jerrellmardis.umbrella" android:ver

我无法使用BOOT_COMPLETED意图调用BroadcastReceiver onReceive方法

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.jerrellmardis.umbrella"
      android:versionCode="4"
      android:versionName="1.0.3">
    <application android:icon="@drawable/icon" android:label="@string/app_name" 
            android:theme="@android:style/Theme.NoTitleBar">
        <activity android:name=".activities.Umbrella" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activities.Preferences" android:label="@string/app_name" android:screenOrientation="portrait" />
        <receiver android:name="com.jerrellmardis.umbrella.receiver.WeatherStartupReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service android:name=".service.WeatherUpdateService">
            <intent-filter>
                <action android:name="com.jerrellmardis.umbrella.service.WeatherUpdateService" />
            </intent-filter>
        </service>
    </application>
    <uses-sdk android:minSdkVersion="3" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>

编辑:忘记一切,我找到了更好的解释

您必须使用exported=true和enabled=true定义接收器

<receiver android:name="com.jerrellmardis.umbrella.receiver.WeatherStartupReceiver"
  android:enabled="true" 
  android:exported="true" 
>


我想如果你改变这条线

<receiver android:name="com.jerrellmardis.umbrella.receiver.WeatherStartupReceiver">

为此

<receiver android:name=".WeatherStartupReceiver">

它会解决你的问题


我在我的一个项目上尝试了它,但它没有启动。

所有接收
启动完成的
广播的应用程序都必须安装在内部存储上,因为Android在外部存储安装到设备之前提供
操作启动完成的
广播

要确保应用程序将安装在内存中,只需NOT声明
android:installLocation
manifest属性即可

另一个选项是在清单部分设置以下内容:
android:installLocation=“internalOnly”


您可以找到更多相关信息。

我不知道您为什么会遇到问题,但我肯定不必为我的启动完成接收器声明启用和导出以接收通知。我已经重新阅读了android文档,他们肯定会说启用和导出的属性默认设置为“true”... 我又错了:S.我在oracleicom的代码中没有看到任何其他奇怪的东西,所以将接收者的名称更改为“.WeatherStartupReceiver”,即使该类不是我的应用程序目录的根目录?当前的目录结构是/receiver/WeatherStartupReceiver.java,因此我尝试在AndroidManifest中更改接收器的名称,但没有成功。为了确保我没有注意到该方法正在被调用,我更改了接收者的onReceive方法以抛出异常,但仍然没有结果。解决了!!!由于应用程序安装在SD卡上,因此无法启动,因此无法正常工作。谢谢大家的帮助!oracleicom,问题是如何解决的。请告知你的链接包含一个导致404的周期。删除尾随句点可以解决此问题。编辑已提交。
<receiver android:name=".WeatherStartupReceiver">