Service Intent must be explicit--服务的intent必须使用显示传递
2016-05-11 00:00
375 查看
就在我庆幸这次完成了按字母顺序排列音乐,自定义扫描手机中的音乐两个功能后,准备更新博客,那就发张截图给大家看看我做出来的效果吧!然后发现了BUG
。音乐不能播放了!!!事态很严重,立马查找是不是哪的代码被我修改错了,debug一下,流程正常。把报错内容java.lang.IllegalArgumentException: Service Intent must be explicit贴出来查了下原来是前一天我把我手机系统升级到5.0的原因!!
Android 5.0 需要显性调用 Service
于是乎就把Intent修改成显式传递
原来是这么写:
修改后这么写:
。音乐不能播放了!!!事态很严重,立马查找是不是哪的代码被我修改错了,debug一下,流程正常。把报错内容java.lang.IllegalArgumentException: Service Intent must be explicit贴出来查了下原来是前一天我把我手机系统升级到5.0的原因!!
Android 5.0 需要显性调用 Service
于是乎就把Intent修改成显式传递
原来是这么写:
Intent intent = new Intent(); intent.setAction("com.app.media.music_service"); intent.putExtra("idOption", myPosition); startService(intent);
修改后这么写:
Intent intent = new Intent(MainActivity.this,MusicService.class); intent.setAction("com.app.media.music_service"); intent.putExtra("idOption", myPosition); startService(intent);
相关文章推荐
- app启动前闪现白屏、黑屏问题解决
- MySql数据库连接失败--org.apache.tomcat.dbcp.dbcp.SQLNestedException
- 使用Navicat for MySql导入.CSV文件
- java传值与传引用学习
- gson转list
- android刷新媒体数据库
- 基础总结篇之一:Activity生命周期
- Swift 项目中可能用到的第三方框架
- mysql导入导出数据中文乱码解决方法小结
- 移动互联网下的社群模式背后的隐患
- 选择蜂窝教育IOS培训 为自己“充电”
- 小代码
- BZOJ 3530 【Sdoi2014】 数数
- QQ通信原理
- linux下创建oracle表空间
- Linux命令(基本)
- Openwrt下获取进程pid的实用shell
- day5-simple ftp
- 什么是 Polymer 【1】
- 快速浏览一下Polymer【2】