question

ojhatushar avatar image
ojhatushar asked chanel Deactivated edited

Issue in delay in applying discount due to binding exception

com.clover.sdk.v1.BindingException: Could not bind to Android service
Hi
We have make an app using clover sdk in which we are applying discount . We have a background service in that app, that is updating the order and we are removing discount and putting order level discount again when some criteria gets fulfilled on register app, using below method of clover sdk:-

Order ord = orderConnector.getOrder(orderID);
ID.add(ord.getDiscounts().get(i).getId());
orderConnector.deleteDiscounts(orderID, ID);

but sometime it show binding exception on first line. and take delay in showing discount on dashboard of register app I have already connected orderconnector and discount is applied on order level using below method:-

orderConnector.addDiscount(orderID,discount);

Is these exception came only in emulator(genymotion) and not in real device?
Because I am testing on emulator and all apps are updated of emulator and I have emulated and tested on both clover mini emulators first and second generation.but same below exception repeated.

Exception is as shown:-
I/ServiceConnector: waitForConnection result: true, retryCount: 0
I/ServiceConnector: waitForConnection result: true, retryCount: 1
I/ServiceConnector: waitForConnection result: true, retryCount: 2

com.clover.sdk.v1.BindingException: Could not bind to Android service
at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:199
at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:245)
at com.clover.sdk.v3.order.OrderV31Connector.getOrder(OrderV31Connector.java:204)at ai.predictivemarketing.volumediscount.service.CalculationService$AddDiscountAsyncTask_2$2.execute(CalculationService.java:1267)at io.realm.Realm.executeTransaction(Realm.java:1493) at ai.predictivemarketing.volumediscount.service.CalculationService$AddDiscountAsyncTask_2.doInBackground(CalculationService.java:1038) at ai.predictivemarketing.volumediscount.service.CalculationService$AddDiscountAsyncTask_2.doInBackground(CalculationService.java:916) at android.os.AsyncTask$2.call(AsyncTask.java:333)at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)
Orders
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

chanel avatar image
chanel Deactivated answered chanel Deactivated edited
Usually a BindingException means the app is binding repeatedly but never unbinding. Ensure that you always call disconnect() on your connector when finished. Normally you'd do this in onCreate / onDestroy or onStart / onStop.
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community