今天写一个Service时,在manifest文件的<service>标签发现了这个警告 

<service  
     
    android:name="SendService">  
    <intent-filter>  
        <action android:name="com.oem.OEMSendService.SENDMAIL" />  
    </intent-filter>  
      
</service>  

查了下api,终于发现一些端倪

原因:这是一个可以被外部访问的service,需要使用权限来限制外部访问

解决方法:

1.添加

android:exported="false"

这种方法是限制外部访问,自然不需要权限了

2.声明权限

先在<manifest>标签下加入

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

然后在<service>标签下

android:permission="oem.permission.SENDMAIL"

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2021-05-27
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-02-26
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-01-15
相关资源
相似解决方案