Android Context.bindService 总是返回 false 并且 ServiceConnection 对象永远不会被触发
我遵循了 Google 提供的本地服务示例,但是我的Context::bindService(...)
始终返回 false,并且 ServiceConnection::onServiceConnected
也从未被调用。
我知道 Context::bindService() 会立即返回,但我的 ServiceConnection 对象永远不会被触发。
我不知道这些是否适用
- 我的活动正在 tabHost 内运行,我想知道这是否会以任何方式影响服务绑定。
- 服务本身可能有问题,但我可以使用相同的 Intent 调用启动服务来启动服务,并且它按预期工作。
有人有这方面的经验吗?请帮帮我。
谢谢, PS我的目标是Android 1.6
I have followed the Local Service example provided by Google, but my Context::bindService(...)
always returns false and there is ServiceConnection::onServiceConnected
is also never called.
I understand that Context::bindService()
returns immediately, but my ServiceConnection
object is never triggered.
I don't know if these apply
- My activity is running inside a tabHost and I was wondering if that can affect service binding in any way.
- The Service itself may have a problem, but I can call start service to the same service with the same
Intent
and it works as expected.
Does anyone have experience with this? Please help me out.
Thanks,
P.S. I am targeting Android 1.6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以我终于想通了。事实证明,TabSpec 无法绑定到 Activity
希望这对某人有帮助!
So I finally figured it out. It turns out that TabSpec cannot bind to activities
Hope this helps someone!
我现在这已经很旧了,但我遇到了一个稍微不同的问题。我重构了我的项目的包。因此文件的名称发生了变化,但 Eclipse 没有更新清单文件。因此,我手动修复了清单文件并更改了包的名称。
I now this is old, but I had a slightly different problem. I refactored the package of my project. So the name changed of the files, but Eclipse did not update the manifest file. So, I manually fixed the manifest file and changed the name of the package there as well.