文章类型: ANDROID
关键词: android,Exported,service,does,not,require,permission警告
内容摘要: Exported service does not require permission警告

android开发中的"Exported service does not require permission"警告

2017/9/8 11:14:22    来源:apple    阅读:
<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"


还有这样的情况:

<!-- 开机自启动服务-->

         <service android:name="com.landcom_med.handsetmonitor.service.AutoStartService"

            android:label="AutoStartService"

            android:enabled="true"

            android:exported="true"

            android:process=":remote">

        </service>

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

需要:

声明权限

先在<manifest>标签下加入

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

即可。

↑ 上一篇文章:从Java到C++——数组的用法 关键词:从Java到C++——数组的用法 发布日期:2017/9/8 9:28:04
↓ 下一篇文章:如何将背景音乐嵌入到PPT文件中不需要音乐文件 关键词:ppt,背景音乐如何不用连接,直接植入到PPT文件里面,.. 发布日期:2017/9/9 14:34:31
相关文章:
Exported service does not require permission警告 关键词:Exported,service,does,not,require,permission,警告,.. 发布日期:2017-09-20 11:21
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found解决办法 关键词:Plugin,with,id,,com,github.dcendents.android-mav.. 发布日期:2019-10-31 14:54
android开发中在文件AndroidManifest.xml中出现警告"Not targeting the latest versions of Android" 关键词:android,警告,开发,文件,AndroidManifest.xml,Not,targeti.. 发布日期:2017-09-20 11:26
相关目录:.NETANDROIDJAVA软件开发
我要评论
正在加载评论信息......