AIDL使用绑定启动远程Service出现Service Intent must be explicit: Intent
Intent intent = new Intent();
intent.setAction("remote.MyRemoteService.Action");
使用AIDL调用远程Service通过隐式意图的方式,但是出现了
Service Intent must be explicit: Intent { act=remote.MyRemoteService.Action }
抛出了一个异常,说意图不明确?
Android5.0以后绑定启动Service考虑到安全愿意,不允许隐式意图的方式启动,也就是说要给出一个明确的组件Service。intent.setPackage(String packageName)或者intent.setComponent(ComponentName componentName)都可以显示设置组件处理意图。那么下面这两种方式都能够解决:
Intent intent = new Intent();
intent.setAction("remote.MyRemoteService.Action");//Service过滤器的内容
intent.setPackage("cy.review.servicetest");//待使用远程Service所属应用的包名
Intent intent = new Intent();
intent.setAction("remote.MyRemoteService.Action");//Service过滤器的内容
//第一个参数待使用远程Service所属应用的包名,第二个参数所启动的远程Service完整类名
ComponentName componentName = new ComponentName(
"cy.review.servicetest",
"remote.MyRemoteService");
intent.setComponent(componentName);
参考:
https://blog.csdn.net/l2show/article/details/47421961
https://www.jianshu.com/p/52565022594e
AIDL使用绑定启动远程Service出现Service Intent must be explicit: Intent的更多相关文章
- java.lang.IllegalArgumentException: Service Intent must be explicit: Intent
在Activity中启动Service的时候报错: 服务意图必须是显性声明. 这是为了防止造成冲突(i.e. 有多个Service用同样的intent-filter的情况) 这是Android 5.0 ...
- 我的Android进阶之旅------>如何解决Android 5.0中出现的警告: Service Intent must be explicit:
我的Android进阶之旅-->如何解决Android 5.0中出现的警告: java.lang.IllegalArgumentException: Service Intent must be ...
- 我的Android进阶之旅------>怎样解决Android 5.0中出现的警告: Service Intent must be explicit:
我的Android进阶之旅-->怎样解决Android 5.0中出现的警告: java.lang.IllegalArgumentException: Service Intent must be ...
- Activity 怎么和 Service 绑定,怎么在 Activity 中启动自己对应的 Service?
Activity 通过 bindService(Intent service, ServiceConnection conn, int flags)跟 Service 进行绑定,当绑定成功的时候 Se ...
- Android Service总结03 之被启动的服务 -- Started Service
Android Service总结03 之被启动的服务 -- Started Service 版本 版本说明 发布时间 发布人 V1.0 添加了Service的介绍和示例 2013-03-17 Sky ...
- 没有启动 ASP.NET State service错误的解决方法
具体错误如下: 异常详细信息: System.Web.HttpException: 无法向会话状态服务器发出会话状态请求.请确保已启动 ASP.NET State service,并且客户端和服务器端 ...
- IIS启动失败,启动Windows Process Activation Service时,出现错误13:数据无效 ;HTTP 错误 401.2 - Unauthorized 由于身份验证头无效,您无权查看此页
因为修改过管理员账号的密码后重启服务器导致IIS无法启动,出现已下异常 1.解决:"启动Windows Process Activation Service时,出现错误13:数据无效&quo ...
- Android开发之通过Intent启动其他App的Service
在Android5.0以前可以通过隐式Intent方式启动其他App的Service,就跟Activity启动隐式Intent一样的. 但是在5.0以后,只能使用显示的Intent方式启动了. 启动其 ...
- Windows Service 学习系列(二):C# windows服务:安装、卸载、启动和停止Windows Service几种方式
一.通过InstallUtil.exe安装.卸载.启动.停止Windows Service 方法一 1.以管理员身份运行cmd 2.安装windows服务 切换cd C:\Windows\Micros ...
随机推荐
- scrapy(创建scrapy工程)报错:“ ImportError:DLL load failed:找不到指定的模块”
先要确定什么模块找不到 解决方法 windowa环境下加 ( --user) pip install -I cryptography --user
- 《React后台管理系统实战 :一》:目录结构、引入antd、引入路由、写login页面、使用antd的form登录组件、form前台验证、高阶函数/组件
实战 上接,笔记:https://blog.csdn.net/u010132177/article/details/104150177 https://gitee.com/pasaulis/react ...
- 从POST和GET和request过滤掉SQL注入
替换掉sql关键字,进行处理 // sql参数过滤 function sqlCheck($paramater){ $arr = array(); foreach($paramater as $k=&g ...
- mybatis动态参数查询
参考:https://blog.csdn.net/zbw18297786698/article/details/53727594
- Spring--@configuration 和 @Bean
参考:http://wiki.jikexueyuan.com/project/spring/java-based-configuration.html @Configuration 和 @Bean 注 ...
- 、第1节 kafka消息队列:8、9、kafka的配置文件server.properties的说明
10.kafka的配置文件说明 Server.properties配置文件说明 #broker的全局唯一编号,不能重复 broker.id=0 #用来监听链接的端口,producer或consumer ...
- ROS学习笔记9-创建ros消息和服务
该节内容主要来自于官方文档的两个小节:1.使用rosed来编辑2.创建ros消息的服务 先来看rosed: rosedrosed命令是rosbash的一部分,使用rosed可以直接编辑包中的一个文件, ...
- 在CentOS中配置java jdk环境
方法一. 1.查看yum库中都有哪些jdk版本(暂时只发现了openjdk) [root@localhost ~]# yum search java|grep jdkldapjdk-javadoc.x ...
- Python栈溢出【新手必学】
python3.5.4 递归函数最恶心的时候莫非栈溢出(Stack overflow).PS:另外很多人在学习Python的过程中,往往因为没有好的教程或者没人指导从而导致自己容易放弃,为此我建了个P ...
- 【Unity】稍微说一下关于各种坐标的转换。比如WorldToScreenPoint
之前写了一篇关于在物体头顶上显示名字的随笔. 估计难懂的点就在各种坐标的转换. 这里详细(就我这水平,怎么可能详细~~~)解说一下.额............. 用另一种方式举个栗子吧. 还是实现在物 ...