I am using a BraodCastReceiver that starts an IntentService. Everythings look working good, but I get this error which I don't know its source:
android.app.ServiceConnectionLeaked: Service com.merchantech.app.smartdiscount.MyIntentService has leaked ServiceConnection com.clover.sdk.v3.order.OrderConnector@535008f4 that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
at android.app.ContextImpl.bindService(ContextImpl.java:1426)
at android.app.ContextImpl.bindService(ContextImpl.java:1415)
at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
at com.clover.sdk.v1.ServiceConnector.connect(ServiceConnector.java:119)
at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:148)
at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:209)
at com.clover.sdk.v3.order.OrderConnector.getOrder(OrderConnector.java:153)
at com.merchantech.app.smartdiscount.MyIntentService.onHandleIntent(MyIntentService.java:41)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
Here's my BrodcastReceiver class:
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("com.test.intent.action.LINE_ITEM_ADDED")) {
Intent i = new Intent(context, MyIntentService.class);
context.startService(i);
}
}
}
And here's my IntentService class:
public class MyIntentService extends IntentService {
public MyIntentService() {
super("MyIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
orderItem.addLineItem(orderId, lineItemId, var);
}
}
Solved:
The problem is due to the Clover SDK. They have not unbind a service that was bounded somewhere in the com.clover.sdk.v3.order.OrderConnector Class. So the problem is not relevant to the code snippet above.