<service
android:name="SendService">
<intent-filter>
<action android:name="com.testapp.ACTION" />
</intent-filter>
</service>
原因:这是一个可以被外部访问的service,需要使用权限来限制外部访问
解决方法:
1.添加
android:exported="false
"
这种方法是限制外部访问,自然不需要权限了
2.声明权限
先在<manifest>标签下加入
<permission android:protectionLevel="normal" android:name="com.testapp.ACTION"></permission>
然后在<service>标签下
android:permission="com.testapp.ACTION"