zoukankan      html  css  js  c++  java
  • [Android Memory] android 警告:Exported activity does not require permission

    在一个应用程序中添加了多个antivity后,在manifest.xml文件中会除了主Activity外,其它的Activity属性中都会有个警告:
    Exported activity does not require permission

    这是因为在Activity中添加了intent-filter属性,这个属性的添加意味着该Activity已经暴露给了不同进程的应用,也就是 说其它的应用程序不需要任何权限就可以自由的实例化该Activity。显然,如果不是有特殊需求,没人会希望自己写得应用程序会有这么个隐患。

    解决方法:
    在Activity中添加:
    android:exported="false"。

    还有一种解决方法是定义Activity的权限。

    先在<manifest>标签下加入

    <permission android:protectionLevel="normal" android:name="oem.permission.SENDMAIL"></permission>

    然后在<service>标签下

    android:permission="oem.permission.SENDMAIL"

    <service android:permission = "oem.permission.SENDMAIL"  android:name = ".AIDLService" >
       <intent-filter>
         <action android:name = "com.example.server.AIDLService"  />
         <category android:name = "android.intent.category.DEFAULT"  />
       </intent-filter>
    </service>
  • 相关阅读:
    能直接调用析构函数,不能直接调用构造函数
    第二章、IP协议详解
    第一章、TCP协议详解
    STL
    容器
    7、jQuery选择器及绑定方法
    6、JQuery语法
    5、DOM 定时器 和 JQuery 选择器
    4、DOM之正则表达式
    3、JS函数与DOM事件
  • 原文地址:https://www.cnblogs.com/0616--ataozhijia/p/3738569.html
Copyright © 2011-2022 走看看