2013-10-05 81 views
0

我已註冊了MyBroadcastReceiver for android.intent.action.CALL_BUTTON。當我運行該程序時,出現LogCat中的ServiceConnectionLeakError錯誤。ServiceConnection使用廣播Reeciver時泄露

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 [email protected]20060 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 [email protected]20060 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 [email protected]64ec8 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) 
+0

好的問題,你可以請發佈代碼,你打電話BroadCastReciver .. –

+0

android.intent.action.CALL_BUTTON系統事件自動應該調用BroadCastReceiver。 – saravanan

回答

0

在你的模擬器。 settings-> Apps。在那裏刷到'所有'的應用程序,你可以找到'Exchange Services',打開並禁用。 希望你不會得到那個錯誤

+0

即使在MyPhone中禁用Exchange服務後,我也遇到了同樣的錯誤。 – saravanan

相關問題