这是什么意思泄漏的服务连接? [英] What does it mean to leak a service connection?

查看:99
本文介绍了这是什么意思泄漏的服务连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写我的Andr​​oid应用程序服务,我想了解如何结合工作机制。 如果我绑定我的服务在活动的onCreate,但我不解除它的onStop或的onDestroy,我得到的错误:

I am writing a service for my Android app and I am trying to understand how the binding mechanism works. If I bind my service in the onCreate of an activity but I don't unbind it in onStop or onDestroy, I get the error :

android.app.ServiceConnectionLeaked: Service com.google.ipc.invalidation.ticl.android.AndroidInvalidationService has leaked ServiceConnection com.googl
                              e.ipc.invalidation.external.client.android.service.ServiceBinder$1@4177f8f8 that was originally bound here

所以我的问题是:什么问题正好与泄漏的连接,我是什么preventing被解除绑定我的服务

So my question is : what is the problem exactly with leaking a connection, what am I preventing by unbinding my service ?

推荐答案

这是发生在Android操作系统的破坏活动,并认为A ServiceConnection 还是绑定到运行中的服务,所以你需要取消绑定破坏之前该服务的活动

that happens when Android OS destroys Activity and finds that A ServiceConnection still binded to a running Service, so you need to Unbind the service before destroying your Activity

这篇关于这是什么意思泄漏的服务连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆