private void initializeMyTender(final Context context) { new AsyncTask<Void, Void, Exception>() { private TenderConnector tenderConnector; @Override protected void onPreExecute() { super.onPreExecute(); tenderConnector = new TenderConnector(context, CloverAccount.getAccount(context), null); tenderConnector.connect(); } @Override protected Exception doInBackground(Void... params) { try { tenderConnector.checkAndCreateTender(getString(R.string.tender_name), getPackageName(), true, false, new ServiceConnector.Callback<Tender>() { @Override public void onServiceSuccess(Tender result, ResultStatus status) { ((MyApplication) getApplication()).setTenderId(result.getId()); } @Override public void onServiceFailure(ResultStatus status) { } @Override public void onServiceConnectionFailure() { } }); // initialization } catch (Exception exception) { Log.e(TAG, exception.getMessage(), exception.getCause()); return exception; } return null; } @Override protected void onPostExecute(Exception exception) { if (exception != null) { displayToastMessage(exception.getMessage()); } tenderConnector.disconnect(); tenderConnector = null; } }.execute(); }
When they are testing it in production, however; the tender does not show up in the register. They sent a Logcat stacktrace with :
10-02 16:13:37.418 22753-22753/? E/ActivityThread: Activity com.my.application.Activities.MainActivity has leaked ServiceConnection com.clover.sdk.v1.tender.TenderConnector@423e8c78 that was originally bound here android.app.ServiceConnectionLeaked: Activity com.my.Application.Activities.MainActivity has leaked ServiceConnection com.clover.sdk.v1.tender.TenderConnector@423e8c78 that was originally bound here at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:978) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:872) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1569) at android.app.ContextImpl.bindService(ContextImpl.java:1552) at android.content.ContextWrapper.bindService(ContextWrapper.java:517) at com.clover.sdk.v1.ServiceConnector.connect(ServiceConnector.java:135) at com.clover.sdk.v1.ServiceConnector.waitForConnection(ServiceConnector.java:163) at com.clover.sdk.v1.ServiceConnector$1.run(ServiceConnector.java:241) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)
All the line numbers in the stack trace are outside of my code, and I'm not sure what I'm doing wrong as it works without issue in the sandbox. Anyone else have a similar issue or know what I've missed?