I am having a weird situation while using OrderConnector.
Below is the code:
ExecutorService executor = Executors.newCachedThreadPool(); orderID = intent.getStringExtra("com.clover.intent.extra.ORDER_ID"); amount = intent.getLongExtra("com.clover.intent.extra.AMOUNT", 0L); tenderID = intent.getStringExtra("com.clover.intent.extra.TENDER"); paymentID = intent.getStringExtra("com.clover.intent.extra.PAYMENT_ID"); boolean result = orderConnector.connect(); Log.e("1 ORDER CONNECTOR ", (orderConnector.isConnected())?"YES":"NO"); Callable<Order> orderCallable = () ->orderConnector.getOrder(orderID);
The first run of the application will die at the orderConnector.getOrder(orderID) due to not binding to android service. boolean result is true when I try to connect(). Below is the logcat:
2022-03-23 01:19:16.449 17560-17630/com.cp.kountsolution I/ServiceConnector: waitForConnection result: true, retryCount: 0
2022-03-23 01:19:19.451 17560-17630/com.cp.kountsolution I/ServiceConnector: waitForConnection result: true, retryCount: 1
2022-03-23 01:19:22.452 17560-17630/com.cp.kountsolution I/ServiceConnector: waitForConnection result: true, retryCount: 2
2022-03-23 01:19:22.455 17560-17560/com.cp.kountsolution W/System.err: java.util.concurrent.ExecutionException: com.clover.sdk.v1.BindingException: Could not bind to Android service
2022-03-23 01:19:22.456 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.FutureTask.report(FutureTask.java:123)
2022-03-23 01:19:22.457 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.FutureTask.get(FutureTask.java:193)
2022-03-23 01:19:22.457 17560-17560/com.cp.kountsolution W/System.err: at com.cp.kountsolution.MainActivity.payment_processed(MainActivity.java:194)
2022-03-23 01:19:22.458 17560-17560/com.cp.kountsolution W/System.err: at com.cp.kountsolution.MainActivity.access$000(MainActivity.java:61)
2022-03-23 01:19:22.458 17560-17560/com.cp.kountsolution W/System.err: at com.cp.kountsolution.MainActivity$1.onReceive(MainActivity.java:88)
2022-03-23 01:19:22.458 17560-17560/com.cp.kountsolution W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313)
2022-03-23 01:19:22.459 17560-17560/com.cp.kountsolution W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
2022-03-23 01:19:22.459 17560-17560/com.cp.kountsolution W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
2022-03-23 01:19:22.459 17560-17560/com.cp.kountsolution W/System.err: at android.os.Handler.handleCallback(Handler.java:790)
2022-03-23 01:19:22.459 17560-17560/com.cp.kountsolution W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
2022-03-23 01:19:22.460 17560-17560/com.cp.kountsolution W/System.err: at android.os.Looper.loop(Looper.java:164)
2022-03-23 01:19:22.460 17560-17560/com.cp.kountsolution W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
2022-03-23 01:19:22.460 17560-17560/com.cp.kountsolution W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2022-03-23 01:19:22.461 17560-17560/com.cp.kountsolution W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
2022-03-23 01:19:22.461 17560-17560/com.cp.kountsolution W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2022-03-23 01:19:22.462 17560-17560/com.cp.kountsolution W/System.err: Caused by: com.clover.sdk.v1.BindingException: Could not bind to Android service
2022-03-23 01:19:22.462 17560-17560/com.cp.kountsolution W/System.err: at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:216)
2022-03-23 01:19:22.462 17560-17560/com.cp.kountsolution W/System.err: at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:262)
2022-03-23 01:19:22.463 17560-17560/com.cp.kountsolution W/System.err: at com.clover.sdk.v3.order.OrderV31Connector.getOrder(OrderV31Connector.java:210)
2022-03-23 01:19:22.463 17560-17560/com.cp.kountsolution W/System.err: at com.cp.kountsolution.MainActivity.lambda$payment_processed$0$com-cp-kountsolution-MainActivity(MainActivity.java:188)
2022-03-23 01:19:22.463 17560-17560/com.cp.kountsolution W/System.err: at com.cp.kountsolution.MainActivity$$ExternalSyntheticLambda0.call(Unknown Source:2)
2022-03-23 01:19:22.463 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:479)
2022-03-23 01:19:22.464 17560-17560/com.cp.kountsolution W/System.err: at java.security.AccessController.doPrivileged(AccessController.java:69)
2022-03-23 01:19:22.464 17560-17560/com.cp.kountsolution W/System.err: at java.security.AccessController.doPrivileged(AccessController.java:94)
2022-03-23 01:19:22.464 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:476)
2022-03-23 01:19:22.464 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2022-03-23 01:19:22.465 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2022-03-23 01:19:22.465 17560-17560/com.cp.kountsolution W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2022-03-23 01:19:22.465 17560-17560/com.cp.kountsolution W/System.err: at java.lang.Thread.run(Thread.java:764)
2022-03-23 01:19:22.465 17560-17560/com.cp.kountsolution E/7 ORDER CONNECTOR: NO
If you keep running the second time, third time and so on...... binding exception will never thrown again (it's connected for some reason)
HELP please.