在一个应用程序中添加了多个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>

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-28
  • 2021-10-24
  • 2021-11-01
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案