在
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并解除绑定?