question

darrank avatar image
darrank asked darrank commented

Custom Tender Service failure: Could not bind to Android service

I am trying to connect to the TenderConnector, but keep getting the following expection:


com.clover.sdk.v1.BindingException: Could not bind to Android service


This is my implementation:

suspend fun checkTenderStatus(tenderConnector: TenderConnector, tenderLabelKey: String) =

    suspendCoroutine<TenderStatus> { cont ->
        var result: TenderStatus = TenderStatus.Fail(Exception("Check Status Failed."))
        tenderConnector.connect()
        tenderConnector.getTenders(object : TenderConnector.TenderCallback<List<Tender>>() {
            override fun onServiceConnectionFailure() {
                super.onServiceConnectionFailure()
                cont.resume(result)
            }

            override fun onServiceSuccess(tenders: List<Tender>?, status: ResultStatus?) {
                super.onServiceSuccess(tenders, status)

                val tender = tenders?.find { it.labelKey == tenderLabelKey }
                if (tender != null) {
                    result = if (tender.enabled) {
                        TenderStatus.Enabled(tender.id)
                    } else {
                        TenderStatus.NotEnabled
                    }
                } else {
                    result = TenderStatus.NotRun
                }

                cont.resume(result)
            }

            override fun onServiceFailure(status: ResultStatus?) {
                super.onServiceFailure(status)
                cont.resume(result)
            }
        })
    }
Custom Tenders
1 comment
10 |2000

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

darrank avatar image darrank commented ·

This was on an emulator. Running the same code on a developer kit works.

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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