[英]broadcast receiver gets unregistered on device reboot
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="" android:installLocation="internalOnly">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
>
<receiver
android:name=".NotifReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<activity
android:name=".MainActivity"
android:label="" android:theme="@style/AppTheme">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
</application>
i have a broadcast receiver which should be triggered when device is booted but it never gets triggered when device is booted instead the whole broadcast receiver gets unregistered.i know this has been asked multiple times before but none of the solutions seem to work我有一个广播接收器,它应该在设备启动时触发,但在设备启动时它永远不会被触发,而是整个广播接收器被取消注册。我知道这已经被多次询问,但似乎没有一个解决方案有效
thanks in advance提前致谢
edit: i am using api 19编辑:我正在使用 api 19
Remove android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
from your <receiver>
element.从
<receiver>
元素中删除android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.