Missed Responses
On Android, it’s technically possible for the OS to kill your app while it's in the background before a response is received. If this occurs and the app process is later restarted, you can still receive those missed responses by initializing TeyaAllInOneSDK with a MissedResponseListener.
To ensure missed responses are delivered, you must call TeyaAllInOneSDK as early as possible after the app starts, ideally in the onCreate method of your Application class.
As mentioned in the Setup section, you can implement the missed responses callback by passing a MissedResponseListener to the TeyaAllInOneSDK function:
Kotlin
val teyaAllInOneSDK = TeyaAllInOneSDK(
onMissedResponseListener = object : MissedResponseListener {
override fun onMissedPaymentResponse(
eposTransactionId: String,
finalState: PaymentStateSubscription.PaymentStateDetails,
) {
println("MISSED RESPONSE = eposTransactionId=$eposTransactionId, finalState=$finalState")
}
override fun onMissedReceiptResponse(
gatewayTransactionId: GatewayTransactionId,
result: PrintStateDetails,
) {
println("MISSED RESPONSE = gatewayTransactionId=$gatewayTransactionId, result=$result")
}
override fun onMissedCustomReceiptResponse(
customReceiptId: String,
result: PrintStateDetails,
) {
println("MISSED RESPONSE = customReceiptId=$customReceiptId, result=$result")
}
override fun onMissedRefundResponse(
gatewayPaymentId: GatewayPaymentId,
result: RefundResultSubscription.ResultDetails,
) {
println("MISSED RESPONSE = gatewayPaymentId=$gatewayPaymentId, result=$result")
}
override fun onMissedUnreferencedRefundResponse(
eposTransactionId: String,
finalState: PaymentStateSubscription.PaymentStateDetails,
) {
println("MISSED RESPONSE = eposTransactionId=$eposTransactionId, finalState=$finalState")
}
},
logger = LoggerImpl()
)The following responses may be missed if the operating system kills the app before they are delivered:
onMissedPaymentResponse: Triggered when a payment response was missed.onMissedReceiptResponse: Triggered when a receipt printing result was missed.onMissedCustomReceiptResponse: Triggered when a custom receipt printing result was missed.onMissedRefundResponse: Triggered when a refund result was missed.onMissedUnreferencedRefundResponse: Triggered when an unreferenced refund response was missed.