5

根据 Android O 开发者预览版,我们不能再使用 PACKAGE_REPLACED 意图与清单中声明的​​接收器一起使用。

替代方案是 MY_PACKAGE_REPLACED。但是,当我在代码更改后通过 android studio 更新应用程序时,这种意图似乎并没有触发。而旧的更广泛的意图总是正确地触发。

    <receiver
        android:name=".Receivers.BootEventReceiver"
        android:exported="true"
        android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
        </intent-filter>
    </receiver>

假设接收者本身只是在 onReceive() 中打印一条日志消息。

谷歌搜索表明这似乎是一些 android manifest 合并问题。但我真的不知道如何解决这个问题。

有人能指出我正确的方向吗

4

1 回答 1

5

我决定使用 MY_PACKAGE_REPLACED 意图过滤器制作一个单独的接收器,而不是让一个接收器具有两个意图过滤器。

接收器又开始工作了。希望这可以帮助任何有兴趣的人

于 2017-08-25T23:17:38.043 回答