ServiceConnectionLeaked使用广播接收器时

时间:2013-10-05 06:51:53

标签: android broadcastreceiver

我已经为android.intent.action.CALL_BUTTON注册了MyBroadcastReceiver。当我运行程序时,我在LogCat中收到ServiceConnectionLeaked错误。

public class MyBroadcastReceiver extends BroadcastReceiver {


   @Override
   public void onReceive(Context context, Intent intent) {

       Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show(); 


   }

}

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.collabera.labs.sai"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
         <receiver android:name=".MyBroadcastReceiver"> 
      <intent-filter>
         <action android:name="android.intent.action.CALL_BUTTON">  
      </action>
      </intent-filter>
   </receiver> 
    </application>
    <uses-sdk android:minSdkVersion="8" />
</manifest> 

错误

10-05 07:13:54.640: D/ExchangeService(1527): !!! Email application not found; stopping self
10-05 07:13:54.640: W/Trace(1527): Unexpected value from nativeGetEnabledTags: 0
10-05 07:13:54.640: W/Trace(1527): Unexpected value from nativeGetEnabledTags: 0
10-05 07:13:54.640: E/ActivityThread(1527): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b5020060 that was originally bound here
10-05 07:13:54.640: E/ActivityThread(1527): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b5020060 that was originally bound here

    10-05 06:34:41.205: E/ActivityThread(1527):     at java.lang.Thread.run(Thread.java:856)
    10-05 06:34:41.215: E/StrictMode(1527): null
    10-05 06:34:41.215: E/StrictMode(1527): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b5064ec8 that was originally bound here
    10-05 06:34:41.215: E/StrictMode(1527):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    10-05 06:34:41.215: E/StrictMode(1527):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    10-05 06:34:41.215: E/StrictMode(1527):     at android.app.ContextImpl.bindService(ContextImpl.java:1418)

1 个答案:

答案 0 :(得分:0)

在你的模拟器中。  设置 - &GT;应用服务。在那里滑动到“所有”应用程序,您可以找到“Exchange服务”,打开并禁用。  希望你可能不会得到那个错误