我有一个启动完整的广播接收器,但它没有按预期工作。也不是需要 STATUS_BAR 权限的全屏活动。
我试图在手机启动时查看 LogCat 日志,这就是我发现的:
日志
04-11 14:23:48.718: W/PackageManager(133): Not granting permission
android.permission.BIND_DEVICE_ADMIN to package com.myprojects.myapp (protectionLevel=2 flags=0xbe46)
任何线索为什么会发生这种情况?
我的清单文件有:
<uses-permission android:name="android.permission.BIND_DEVICE_ADMIN"/>
<receiver android:name="com.myprojects.myapp.DeviceAdministrationReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin" android:resource="@xml/device_admin_policies" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<receiver android:name="com.myprojects.myapp.BootCompleteReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
编辑 和其他两个类似的日志:
04-11 14:24:17.810: W/PackageManager(133): Not granting permission android.permission.STATUS_BAR to package com.myprojects.myapp (protectionLevel=3 flags=0xbe46)
04-11 14:24:17.810: W/PackageManager(133): Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.myprojects.myapp (protectionLevel=3 flags=0xbe46)