警告:receiver Exported receiver does not require permission

来源:互联网 发布:淳萃洗发水 知乎 编辑:程序博客网 时间:2024/05/17 19:15

在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 

2 0
原创粉丝点击