android serviceconnection unbind流程,java – Unbind外部服务android Paho MQTT ServiceConnectionLeaked错误...

Android中取消绑定外部服务(位于另一个jar)文件的正确方法是什么?

我将清单文件中的服务(位于org.eclipse.paho.android.service-1.0.2.jar中)声明为:

服务来源here

服务运行正常.但是,在退出应用程序时,我收到ServiceConnectionLeaked错误,在进行一些搜索后,我发现需要调用unbindService(…);在活动的onDestroy()方法上.

日志:

24915-24915/com.testapp.testmqtt E/ActivityThread﹕ Activity com.testapp.testmqtt.MainActivity has leaked ServiceConnection org.eclipse.paho.android.service.MqttAndroidClient$MyServiceConnection@426c50d8 that was originally bound here

android.app.ServiceConnectionLeaked: Activity com.testapp.testmqtt.MainActivity has leaked ServiceConnection org.eclipse.paho.android.service.MqttAndroidClient$MyServiceConnection@426c50d8 that was originally bound here

但是,我没有将ServiceConnection传递给unbindService(),因为我没有手动启动该服务.有没有办法获得该服务的ServiceConnection并解除绑定?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值