您的位置:首页 > 产品设计 > UI/UE

警告:receiver Exported receiver does not require permission

2016-04-11 16:08 399 查看
在Android的AndroidManifest.xml文件下写了多个receiver 其中部分receiver中有

<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />

<data android:scheme="package" />
</intent-filter>


解决办法:

加上android:exported = "false"可以解决这个警告。

<activity
android:name=".MainActivity"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" android:host="example.com" />
</intent-filter>
</activity>


其中android:exported = “false”而没有任何intent-filer的activity只能通过它的class名去调用,就是意味着,这个activity只能在当前的application中被使用,这种情况下android:exported的值为false,否则出现任何一个intent-filer,它的值则为true。

以上查询资料:http://stackoverflow.com/questions/11462936/exported-activity-does-not-require-permission-when-attempting-to-launch-from-a
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: