您的位置:首页 > 移动开发 > Android开发

Android Remote Service 外部访问权限控制

2015-06-01 17:53 656 查看
<Service>可以通过以下参数限制外部访问android:exported="false"                         //不允许其他进程访问android:process=":remote"                       //声明service独立运行进程名称如果需要支持外部访问,但限定只有某些进程可以访问<permission  android:name="com.example.REQUEST_FINGERPRINT"  android:protectionLevel="signature" />               //声明一个自定义权限<service  android:exported="true"                       //允许其他进程访问  android:process=":remote"                     //声明service独立运行进程名称  android:permission="com.example.REQUEST_FINGERPRINT" >  //声明外部访问需要注册的权限然后在需要远程访问该Service的App中引用权限<uses-permission android:name="com.example.REQUEST_FINGERPRINT" />SDK API 21 中,如果声明了一个可外部访问的Service而没有声明所需权限,会在IDE中看到warning:Exported service does not require permission如果App访问了一个需要权限的Service,那么App会崩溃,并提示Error:Not allowed to bind to service Intent

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: